Checkbox 'Checked' in ListView is restored after scrolling

Posted by adrianrdzv on Stack Overflow See other posts from Stack Overflow or by adrianrdzv
Published on 2010-04-04T11:09:28Z Indexed on 2010/04/04 11:13 UTC
Read the original article Hit count: 330

Filed under:
|
|

I'm having the following problem:

I have a ListActivity, which its ListView is composed by an icon, text and a checkbox (using LayoutInflater).

The Adapter for the ListView extends ResourceCursorAdapter (i.e. the data source of the ListView is retrieved from a database, also the Checked status of each row)

Everything works pretty Ok, except when I uncheck/check the checkbox in any row, if I scroll down until the modified checkbox is no longer visible, and then scroll up, the checkbox is restored to its original state.

The database IS modified, this is not the problem (i.e. if I modify a row and exit the activity, and enter again, the modified row is displayed Ok).

My guess is that this has something to do on how the list is rendered because for some reason the ListView "renders" the original state of all rows when it was first populated when scrolling.

I've been looking around for this bug but I don't find anybody that had this problem. I appreciate any advice you have.

© Stack Overflow or respective owner

Related posts about android

Related posts about checkbox