1

So I have this code :

back --;    //when it starts doing that back's value is 5 

if (back == 0) {
    back_button.setClickable(false);    
}

if (back != 0) {
    back_button.setClickable(true);
}

My back_button never sets itself to Clickable(true) after it set to Clickable(false), even when back wasn't equal to 0 caused by another button(back++;).

Why isn't my back_button onClick realizing that?

Son Truong
  • 13,661
  • 5
  • 32
  • 58
Karlay
  • 17
  • 5

1 Answers1

0

Actually view.setClickable() doesn't works at runtime that's why your toggling of back_button doesn't works at runtime .

Solution: Use view.setEnabled(boolean enabled) for your back_button.

Refer to :setEnabled() vs setClickable(), what is the difference?

Sheetal gupta
  • 191
  • 1
  • 10