Possible Duplicate:
Maintain/Save/Restore scroll position when returning to a ListView
The user views a listview of items, they move to an activity that shows detail for one item, and then hit Back and return to the list activity but I want the list to reflect its prior scroll position.
Should I store the scroll position as a member variable on the activity in onPause or is there a better way?
Save the position in an instance variable on onPause and in onResume check if there is position value and move to it.
e.g. using
private int currentPostion;
and then in onResume do..
getListView().setSelection(currentPosition);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With