Listview Refresh Taking It To The Top Of The List
Scenario: I am using a listview with custom Adapter. I am fetching data every 5 seconds and then displaying it in the listview. Problem: After every refresh the list scrolls at the
Solution 1:
Instead of your code please try to put every time you fetch data this one:
adapter.notifyDataSetChanged();
Solution 2:
Instead of calling this, you should set the new data to the adapter and then call notifyDataSetChanged.
Hope this helps!
Solution 3:
As you get new mListData then just invalidate the adapter not re-initialized the adapter you can call like this
mListAdapter.notifyDataSetChanged();
Solution 4:
You can use
mList.setSelection(mListData.size() - CONSTANT.CONTENT_SIZE);
This way the listview will not refresh to the top. Or you can also use
adapter.notifydatasetchanged
by updating the binded list.
Solution 5:
This Worked For Me:
adapter.setData(list);
adapter.notifyDataSetChanged();
Post a Comment for "Listview Refresh Taking It To The Top Of The List"