I have a listview that gets additional views added on request, that’s maintained by a BaseAdapter. How can I maintain scroll position after the update?
I know this has been asked a few times, but each time, the same solution has been put forward, which I have tried, which is to call adapter.notifyDataSetChanged(); after updating the ArrayList that contains the list contents.
How can I ensure that scroll position is maintained?
Implement an
OnScrollListenerin your activity class and then use the following code:If you are using
AsyncTaskfor updating your data, then you can include the following in yourPostExecute()in order to maintain the Scroll position:I hope this helps.