Tuesday, 3 September 2013

checkBox is checked ? Looping inside checkbox elements

checkBox is checked ? Looping inside checkbox elements

int count = listView.getChildCount();
for (int i = 0; i < count; i++) {
View child = list.getChildAt(i);
//check that child..
}
I wanted to use the following code to see if the total number of
checkBox(es) were checked or not. Like if I have 3 checkBoxes I would want
something equivalent to:
if(!list.getChildAt(0) || !list.getChildAt(1) || !list.getChildAt(2)){
// do something with all unchecked checkbox
}
How do I loop through like this, because for one I am not sure about the
number of contents in my checkbox.

No comments:

Post a Comment