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()|| b1.isPressed()){
a2.setClickable(false);
b2.setClickable(false);}
but it didn't work.
Update:
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?