Android disables the button

I can’t understand why this will not disable the button?

btnSaturdayStartTime = (Button)findViewById(R.id.btnSaturdayStartTime);
btnSaturdayStartTime.setEnabled(false);     

When I click on the button, it still starts the listener.

+3
source share
3 answers

Try using btnSaturdayStartTime.setClickable (false).

See setClickable from the documentation.

+3
source

try the method: Button.setClickable(false) ; or remove the listener on your button as follows:button.setOnClickListener(null);

+2
source

The button may be recreated or reactivated between disabling user interaction with the click. Are you sure you turned off the right button? What version of Android are you planning?

0
source

All Articles