I am working on scrolling of listview. I want to load data on scrolling of listview and i am doing like this:
public void onScroll(AbsListView view, int firstVisibleItem,
int visibleItemCount, int totalItemCount) {
if (loading) {
if (totalItemCount > previousTotal) {
loading = false;
previousTotal = totalItemCount;
}
} else {
if ((totalItemCount - visibleItemCount) <= (firstVisibleItem + threshold)) {
new loadMoreListView().execute();
int currentPosition = lv.getFirstVisiblePosition();
View v = lv.getChildAt(0);
int distFromTop = (v == null) ? 0 : v.getTop();
lv.setSelectionFromTop(currentPosition, distFromTop);
}
}
}
loadMoreListView is class which load data using AsynTask. My problem is when i come to the 10th position the listview starts loading data as expected but it freezes the whole listview. I cant interact with listview till data get loaded. Is there any solution to load data and interact with listview simultaneously. Please don't suggest Endless Adapter or Prime. I already tried with that one. Any help is highly appreciated. Thanks in advance.