mardi 26 septembre 2017

How to group checkboxes so that only one can be checked between the groups

I got a layout which contains a RecyclerView. Its list items contains a checkbox. There are about 10 list items, and I need to be able to group them such that the first check box is a group on its own, the 2nd and 3rd checkbox are another group, and the rest of them are unrelated and can be checked freely.

What it means is that if the first checkbox is checked (i.e from the first group), the 2nd and 3rd (i.e the second group) should be unchecked. The 2nd and 3rd boxes can be checked together or separately, but then the 1st check box must be unchecked.

I can only access the check boxes through the public void onBindViewHolder(MyViewHolder holder, int position) of the adapter since like I said, they are a part of a list item.

Is there a way to make it smarter than using the position of the item?




Aucun commentaire:

Enregistrer un commentaire