Reputation: 257
How can I write code in java so that when following IF Condition is true:
if (!online.equals(offline)){
}
Then only the
a1.setOnClickListener(new View.OnClickListener() {
**algorithm**
}
gets activated else the button stays unclickable.
NOTE: Both "online" and "offline" are String variable.
Upvotes: 0
Views: 156
Reputation: 93561
Use the enabled feature. myButton.setEnabled(false)
makes it unclickable, myButton.setEnabled(true)
makes it clickable. You can even use state list drawables to make disabled buttons look different.
Upvotes: 9