In Honeycomb the Loader APIs were introduced as the proper way to provide data to an application by doing the heavy lifting on a background thread. In my application I'm working to replace all my Cursor
s with Loader
s that return Cursor
s. Since Cursor.requery()
is depreciated now, it is recommended to just call restartLoader
and allow the work to again be done on a background thread and then changeCursor
when it returns in onLoadFinished
.
All of this works wonderfully except that the ListView doesn't maintain it's scroll position when I want to requery the data, using Cursor.requery()
this used to work because it was the same Cursor instance with updated data.
How can I refresh my Loader without loosing the scroll position?
getScrollX()
andgetScrollY()
to cache it before you refresh, and then manually set it again. I'm not sure if this would result in visual flashing or other unpleasantness. :-/ – Bulger