How to clear the check boxes when the reset button is clicked

advertisements

In my project I have a number of checkboxes in a linear layout. When running the project by default all checkboxes are unchecked and I need to check some checkboxes. Below the checkboxes there is a reset button. When the reset button is clicked all the checkboxes are unchecked. How do I do this? Please help.


Call this in onClick()of Reset button.

if (checkBox1.isChecked()) {
             checkBox1.setChecked(false);
         }
if (checkBox2.isChecked()) {
             checkBox2.setChecked(false);
         }

. . . and so on