I'm confused... Any reason you aren't just doing the following?
a1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
a2.setClickable(false);
b2.setClickable(false);
}
});
Or am I missing something?
Thanks,
Justin Anderson
MagouyaWare Developer
http://sites.google.com/site/magouyaware
On Thu, Jun 23, 2011 at 1:15 AM, [email protected] <[email protected]> wrote:
> I tried to add boolean variable
> a1Boolean = false;
> boolean a2Boolean = false;
>
> And after each click
>
> a1.setOnClickListener(new View.OnClickListener() {
>
> @Override
> public void onClick(View v) {
> a1Boolean = true;
>
> And then to check in the method
>
> private boolean geta1_b1() {
> if (a1Boolean || b1Boolean) {
> a2.setClickable(false);
> b2.setClickable(false); }
> return true; }
>
> but when I call this method before all these clicks, of corse, it
> didn't work, because I didn't press any buttons yet. Any ideas how to
> find a right decision?
>
>
> On 22 июн, 23:55, Justin Anderson <[email protected]> wrote:
> > Set an OnClickListener on each button and update the state in the
> listener.
> >
> > Thanks,
> > Justin Anderson
> > MagouyaWare Developerhttp://sites.google.com/site/magouyaware
> >
> >
> >
> >
> >
> >
> >
> > On Wed, Jun 22, 2011 at 8:55 AM, [email protected] <[email protected]> wrote:
> > > by "didn't work" I mean that I still can click both of buttons
> >
> > > On 22 июн, 17:52, Kostya Vasilyev <[email protected]> wrote:
> > > > I see.
> >
> > > > If by "didn't work" you mean that the visual state didn't change -
> you
> > > need
> > > > to use state-list drawables that include
> 'android:state_enabled="false"'
> >
> > > >
> http://developer.android.com/guide/topics/resources/drawable-resource...
> >
> > > > -- Kostya
> >
> > > > 2011/6/22 [email protected] <[email protected]>
> >
> > > > > I cann't use CheckBox, cause it'll be image inside my buttons.:(
> >
> > > > > On 22 июн, 17:39, Kostya Vasilyev <[email protected]> wrote:
> > > > > > Are the buttons actually check boxes?
> >
> > > > > > If so, use CheckBox methods:
> >
> > > > > > setOnCheckedChangeListener
> > > > > > isChecked
> > > > > > setChecked
> >
> > >http://developer.android.com/reference/android/widget/CompoundButton..
> ..
> > > > > > )
> >
> > > > > > -- Kostya
> >
> > > > > > 2011/6/22 [email protected] <[email protected]>
> >
> > > > > > > I have 4 buttons (a1, a2, b1, b2). They can combinate: a1-b1;
> > > a1-b2;
> > > > > > > a2-b1; a2-b2.It means that "a1" and "a2" cann't be chosen
> together.
> > > So
> > > > > > > after clicking "a1" I need to block "a2".And depends on what 2
> > > buttons
> > > > > > > were pressed, it will be differenet actions.I tried something
> like
> > > > > > > this
> >
> > > > > > > if(a1.isPressed()){
> > > > > > > a2.setEnabled(false);
> > > > > > > a2.invalidate();}
> > > > > > > else if (b1.isPressed()){
> > > > > > > b2.setEnabled(false);
> > > > > > > b2.invalidate();}
> >
> > > > > > > but it didn't work.Does anyone have an idea how I can do it?
> Thank
> > > you
> > > > > > > in advance!
> >
> > > > > > > --
> > > > > > > You received this message because you are subscribed to the
> Google
> > > > > > > Groups "Android Developers" group.
> > > > > > > To post to this group, send email to
> > > > > [email protected]
> > > > > > > To unsubscribe from this group, send email to
> > > > > > > [email protected]
> > > > > > > For more options, visit this group at
> > > > > > >http://groups.google.com/group/android-developers?hl=en
> >
> > > > > --
> > > > > You received this message because you are subscribed to the Google
> > > > > Groups "Android Developers" group.
> > > > > To post to this group, send email to
> > > [email protected]
> > > > > To unsubscribe from this group, send email to
> > > > > [email protected]
> > > > > For more options, visit this group at
> > > > >http://groups.google.com/group/android-developers?hl=en
> >
> > > --
> > > You received this message because you are subscribed to the Google
> > > Groups "Android Developers" group.
> > > To post to this group, send email to
> [email protected]
> > > To unsubscribe from this group, send email to
> > > [email protected]
> > > For more options, visit this group at
> > >http://groups.google.com/group/android-developers?hl=en
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en