views:

642

answers:

1

Hi, I choose an item in my list to edit (I use Context Menu) , then I populate data to "refresh" the List and my List will display in "Top-Down" order. I want to display my list right in position of the item I have just edited (I don't have to drag scrollbar down to find it). So, how can I do that?

+1  A: 

Use the ListView.setSelection(int position) method. It will select the list item at the specified position, but only if not in touch mode. If in touch mode, it will just scroll to the specified position so that the item at position is the first on the screen.

From http://d.android.com/:

Sets the currently selected item. If in touch mode, the item will not be selected but it will still be positioned appropriately. If the specified selection position is less than 0, then the item at position 0 will be selected.

Isaac Waller