In my app, my main class extends ListActivity and calls a fillData()
function to reload the list whenever changes are made. I'm still
getting the hang of this, so I borrowed that concept from the Android
Notepadv1-Notepadv3 tutorials. Everything works great, however
whenever I need to change the list (remove an item, re-sort it, edit
an item), the ListView refreshes and loses its scroll position. The
scroll position is reset to the top after each fillData() call.

I saw the following thread a similar issue, but can't wrap my head
around the solution:
http://groups.google.com/group/android-developers/browse_thread/thread/0b648ce2fe622463/7d40155d450d1196?lnk=raot

It appears to be resetting the scroll position to the top because I'm
using setListAdapter() each time in fillData(), setting it to a new
SimpleCursorAdapter. How can I get the list to "update in place",
where the scroll position is seamlessly maintained to the user? I
tried heading down the "items.changeCursor(cursor)" path, but that
didn't seam to do much for me. Any help would be appreciated. Here's
the code:

private void fillData(boolean sortOption) {
        Cursor itemCursor = mDbHelper.fetchAllItems(sortOption);
        startManagingCursor(itemCursor);

        String[] from = new String[] { DbA.KEY_ITEM, DbA.DESCRIPTION,
DbA.KEY_CHECKED };
        int[] to = new int[] { R.id.itemText, R.id.itemDescription,
R.id.content };

        SimpleCursorAdapter items = new SimpleCursorAdapter
(this,R.layout.item_row, itemCursor, from, to);
        items.setViewBinder(new ItemBinder());
        setListAdapter(items);
}

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to