Skip to content Skip to sidebar Skip to footer

Android Button Enabling/disabling Not Working

I need to disable a button based on one parameter present month . Here is my code if(presentMonth > 20) { nextMonth.setClickable(false); nextMonth.setOnClickListener

Solution 1:

try, nextMonth.setEnabled(false). Normally clickable property is set in the XML layout such as android:clickable="true


Solution 2:

I think the methods should work,cause they are meant for that. setEnabled() and yes I have used one other way I remember that like

onClick(View v)
{
     if(!condition)
     {
            //perform onClick stuff
     }
}

Post a Comment for "Android Button Enabling/disabling Not Working"