Search code examples
androidlistviewscrollbarandroid-listviewviewflipper

How to return a listview's scrollbar back to top, after changing data on adapter?


I'm using a ViewFlipper with 2 ListViews: one for categories, and one for data. Every time user picks a category - i update the 2nd listview's data (clear it and add new data), call notifydatachanged, and call the ViewFlipper showNext().

The problem is that when i scroll down in a list, and than go back (showprev) to pick another category, and again flip to the updated list - the scrollbar is where i've left him, in the middle of the listview, and not on top.

how can i take it back to be uppest it can?


Solution

  • You can set the scrollbar to always on top by using: .setSelection(0)