I have a ListView of items with checkboxes.
I have a custom CursorAdapter that checks the checkboxes if the the field value is "1" in it's get View method.
When I click on the list item in the listview, it checks the checkbox and updates the field to "1". The problem I have is when I call the changecursor method on my custom adapter, it reloads everything and points to the first item instead of the item I just clicked on.
In the changeCursor method I have the following:
public void changeCursor(Cursor cursor) {
super.changeCursor(cursor);
init(cursor);
notifyDataSetChanged();
}
Is there a way to maintain the position or a workaround to reload the cursor without making it jump to the first item?
You basically need some data structure to keep track of checked items. you can use boolean array in your custom adapter.
for more info refer this link Custom listview with checkbox problem
listview with checkbox
if you are looking for an example try this http://appfulcrum.com/?p=281 tutorial which solves the checkbox problem in listview using shared preferences.
Thanks