Stuck in implementing Pagination in Android

Posted by user443141 on Stack Overflow See other posts from Stack Overflow or by user443141
Published on 2010-12-26T20:21:22Z Indexed on 2010/12/27 16:54 UTC
Read the original article Hit count: 204

Filed under:

I am implementing pagination for ListView in Android . I am extending the BaseAdapater class for customising the ListView.

Already I have the code working fine for the Customised ListView. Below is the new requirement.

1>I am fetching 6 items from server & displaying them . Now when the user scrolls to the 6th item(end of list) , I need to call the server to fetch the next 6 items & update the Listview

I have overriden the methods

i>public void onScroll(AbsListView view, int firstVisibleItem,int visibleItemCount, int totalItemCount)

ii>public void onScrollStateChanged(AbsListView view, int scrollState)

In the first response from the server, I get the total no of pages from the server & for each time I call the server , I get the current page value .

Kindly provide me the steps/sample code on how to check the last item of the list & update the list . The code should be iterative since I may need to call multiple times & fetch from server.

Warm Regards,

CB

© Stack Overflow or respective owner

Related posts about android