Ian Vink
Ian Vink

Reputation: 68750

Android ListView Jump to cursor position

I have a ListView that is controlled by a standard BaseAdapter.

When the user clicks a button, I want the ListView to Scroll into view the 100th record.

How is that done?

Upvotes: 3

Views: 2706

Answers (1)

Mike
Mike

Reputation: 1481

Try this function

public void setSelection (int position)

Since: API Level 1 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. Parameters position Index (starting at 0) of the data item to be selected.

So myListView.setSelection(99);

Upvotes: 6

Related Questions