Stuck in implementing Pagination in Android
- by user443141
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.
1I 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
ipublic void onScroll(AbsListView view, int firstVisibleItem,int visibleItemCount, int totalItemCount)
iipublic 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