vendredi 18 août 2017

How to check state Changing of CheckBox in android?

I want to check if my Checkboxes are checked to change some values. I got the answer for radioButton which is inserted to a RadioGroup and we can simply use :

radioGroup.setOnCheckedChangeListener(new new OnCheckedChangeListener(){
@Override
    public void onCheckedChanged(RadioGroup group, int checkedId)
    { . . . } 
}

i'm looking for something like this ,However this approach is differ from Checkboxes because there is no widget like CheckboxGroup to use setOnCheckedChangeListener On it .

For example i have checkbox1 and checkbox2. how can i get as long as these two checkboxes are checked to changing some value like :

if(checkbox1==isChecked && checkbox2==isChecked)
//Do sth ...
else 
//Do sth Different




Aucun commentaire:

Enregistrer un commentaire