Android ListView with Checkbox: automatically unchecks?

Apparently the problem was that, by getting the checkbox using convertView.findViewById(), the onCheckedChangeListeners were still intact if the view was recycled. Calling checkbox. SetOnCheckedChangeListener(null) did the trick.

1 I was having the same problem when using checkbox in the child view of an ExpandableListView, and your trick worked for me as well. I had to put this in getChildView(..), where I check if we are recycling (i.e. , convertView is not null), and set the OnCheckedChangeListener of the checkbox to null in that case.

Thanks for the solution. – Samik R Aug 19 '10 at 5:33 I am having a similar problem, but I don't know how to fix it: stackoverflow. Com/questions/4586442/… any ideas?

– ekawas Jan 5 at 15:24 I know its an old thread but I have the same problem. It seems like the onCheckedChangeListener method is called randomly. What exactly do you mean by checkbox.

SetOnCheckedChangeListener(null)? Its the null that confuses me! Have a look at my code if you want: stackoverflow.Com/questions/5444355/… – mixkat Mar 27 at 3:05.

I've got a ListView with a custom BaseAdapter. The list items contain CheckBoxes that need to represent a property from a database. I use CheckBox.

SetOnCheckedChangeListener with a new OnCheckedChangeListener to detect changes, so I can change the database based on the current state of the CheckBox. Pretty straightforward stuff so far. However, when scrolling further down the list, previously checked CheckBoxes get unchecked.

I suspect this happens as soon as the views are recycled (I'm using the convertView/ViewHolder technique). How can I stop this?

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions


Thank You!
send