13
I've got a little question for my Android App. I searched for a long time but found nothing about my problem.
Scenario : I've to display a revert listview (as Facebook Messenger). And when the user scrolls to the top, load more messages.
Problem : After notifiyDataAsChanged() call, the scroll is not the same!
I want to conserve exactly the same position as before loading.
I tried that code :
// save index and top position
int index = list.getFirstVisiblePosition()+result.size();
View v = list.getChildAt(index);
int top = (v == null) ? 0 : v.getTop();
// ...
// restore
list.setSelectionFromTop(index, top);
But the scroll is not exactly the same after loading.
Have you got an idea ?