I have a view that contains a ListView bound to a cursor adapter. When the contents of the cursor change, I want the ListView to be on top, and then in my custom cursor adapter I added:
@Override
protected void onContentChanged() {
myListView.scrollTo(0, 0);
}
but it does not work. Then I read somewhere to queue this action as follows:
myListView.post(new Runnable() {
public void run() {
myListView.scrollTo(0, 0);
}
});
but this also does not work.
How to save a ListView at the top of the page when changing its contents?
EDIT:
Just for a try, I added a button and called scrollTo () in my onClickListener, and that didn't work! What am I missing?
source
share