I am loading a listview from Http server, 20 at a time ,At the end of Listview I a want to load next 20 data from server and this process will continue till
This is what I used to load more data at the end of the listview
listview.setOnScrollListener(new OnScrollListener(){
@Override
public void onScroll(AbsListView view,
int firstVisibleItem, int visibleItemCount,
int totalItemCount) {
//Algorithm to check if the last item is visible or not
final int lastItem = firstVisibleItem + visibleItemCount;
if(lastItem == totalItemCount){
// you have reached end of list, load more data
}
}
@Override
public void onScrollStateChanged(AbsListView view,int scrollState) {
//blank, not using this
}
});