I have two checkboxes with yes or no options.I have to select only one option while disabling the clickable option of other checkbox. opp11 and op12 are two checkboxes.The following code seems to work but what if i have around 20 checkbox options.Is there any method to shorten the code like i can pass two options one to set onchanged listner and other to disable the clickable option.
op11.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener(){
@Override
public void onCheckedChanged(CompoundButton buttonView,
boolean isChecked) {
if(isChecked){
op12.setChecked(false);
// Code to display your message.
}
}
});