dimanche 28 mai 2017

Android Uncheck multiple Checkboxes

my Problem is that i want to create a Checklist with multiple Checkboxes. The biggest Problem is i have more than 100 Checkboxes. I would like an CLEAR Button that clears all Checkboxes by clicking.

How can I do that? And have you an example how to solve it?

The only way i know is that:

Button clear = (Button) findViewById(R.id.clearbtn);
    clear.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            CheckBox cb1 = (CheckBox) findViewById(R.id.checkBox2);
            cb1.setChecked(false);
        }
    });

But that way isnt really effective with over 100 checkboxes ...




Aucun commentaire:

Enregistrer un commentaire