0

I am working on chat application in which I have to manage thousands of chat messages list by paging but my problem is that when I am adding items at the top of ListView adapter during fast scrolling and applying setSelectionFromTop(index, y)...by this my list scrolling getting stuck on index...

 adapter.setData(listChatMessage);
 adapter.notifyDataSetChanged();

 View v = threadList.getChildAt(0);
 int top = (v == null) ? 0 : v.getTop();

 listView.setSelectionFromTop(index, top);

So how can we add items at the top of ListView with scrolling without stuck. What approach should I use.

Can anyone suggest me?

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
hharry_tech
  • 952
  • 1
  • 8
  • 24

2 Answers2

0

If im not wrong take look at this

How to get the scroll speed on a ListView?

then set listView.fling(int velocityY)

sigma119
  • 102
  • 6
0

After a long search I found satisfactory post.

https://chris.banes.me/2013/02/21/listview-keeping-position/

hharry_tech
  • 952
  • 1
  • 8
  • 24