I’m developing an application where I need to turn off and on the onClicKListener on some buttons.
I have an external run method where I want to toggle on the onClickListener to the buttons. In my onCreate method I have code like this:
button.setOnClickListener(this);
In a method I call externally (that is a method which isn’t onCreate) I have a statement which says button.setOnClickListener(null); when a certain condition is fulfilled.
Now I wonder how, to in the same method if another condition is fulfilled turn the onClickListener back on. It doesn’t work with button.setOnClickListener(this);
In my activity I’m implementing onClickListener through extends Activity implements OnClickListener or something.
Thanks in advance!
You just need to update the value of enableClick.