How to ensure that no two checkboxes are enabled in android -


i have custom list view , each item of has check box , text field. want disable check box in every other row of list view if check box of first row enabled.

since stating if first check box clicked others should disabled, check in onbindview() see if checkbox checked. if is, set value is, , following list view entries set checkbox disabled.

in oncheckchangedlistener():

 checkbox1.setoncheckedchangelistener(new compoundbutton.oncheckedchangelistener() {          @override         public void oncheckedchanged(compoundbutton buttonview, boolean ischecked) {             if(ischecked()){                 firstcheckboxchecked = true;             }     }); 

then in onbindview rest:

if(firstcheckboxchecked){     checkbox.setenabled(false); } 

Comments

Popular posts from this blog

android - Why am I getting the message 'Youractivity.java is not an activity subclass or alias' -

Making Empty C++ Project: General exception (Exception from HRESULT:0x80131500) Visual Studio Community 2015 -

How to fix java warning for "The value of the local variable is not used " -