Alex Rivera | Logout

Android Check box Group

Asked 2012-04-12T10:44:07.817
13

I'm trying to apply some kind of validation on a group of check boxes (e.g. Two contradictory items cannot be checked together) so I want to somehow group Check Box objects and apply something like RequiredFieldValidator on the whole group once and in that validator I will register listeners and do the whole check on my Check Boxes objects.

What I imagine would be a code that look like that:

CheckBoxView allMyCheckBoxes = new CheckBoxView(checkbox1,checkbox2,checkbox3); //varargs
validate(allMyCheckBoxes);

Validate will contain the logic of contradictory check boxes and everything.

Is that already implemented somewhere in Android? If not, anybody tried out something like that? (Hopefully share it with us here)

Edit
Report

1 Answer

4

You could use Radio Buttons and set up different groups of them.

This documentation and This tutorial should help you out if you find that Radio Buttons are the way to go.

answered 2012-04-12T13:13:53.653

Your Answer