I'm doing this and is not working, I have researched all over the place but I can't find the right solution. I have researched about onSaveInstanceState()
but I can't get it to work too.
My problem is that when I scroll and press an item from the listview it opens ok, but when I go back it goes to the top of the listview instead of showing me the last item I was on.
I first declare an int position:
int position;
After that I get the position from my listview in my onCreate:
position = mListView.getFirstVisiblePosition();
And after setting the adapter I'm setting the selection to the position of the listview:
mListView.setAdapter(mAdapter);
mListView.setSelection(position);