views:

235

answers:

1

Hello all,

Lets say I have 1 - 1,000 in a list and I click on 250. When I push the back button I want to go back to 250 not all the way back up to 1.

Is this possible?

A: 

I have not tried this but you could try to save the state of the ListActivity before advancing to the next activity. In your list item selection handler you would store the selected index in a Bundle with saveInstanceState() and then advance to the next activity. When the activity is returned to ( user presses back button ) you can override onRestoreInstanceState() which will have the cached Bundle passed to it as a parameter. From there you could call smoothScrollToPosition() on the ListView, passing in the saved index.

jeremynealbrown