I have multiple checkbox in recycle view adapter.and one button in parent view.i want to enable button if any checkbox checked and disable button if all checkboxes are unchecked.how can i do that,
Holder.checboxone.setOnCheckedChangeListener(new
CompButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompButton compButton,
boolean b) {
item.setChecked(b);
checkboxStatus(b);
}
});
private void checkboxStatus(boolean isChecked) {
if (isChecked) {
((MainActivity)context).getButton().setEnabled(true);
} else {
((MainActivity)context).getButton().setEnabled(false);
}
}
According to my code i can enable button when i click ay checkbox,but disable function not working properly,if i unchecked single checkbox also button will disable,i want to disable button after all checkbox uncheck only
Aucun commentaire:
Enregistrer un commentaire