Load more items at the end of a ListView

  • Replies:8
  • OpenNot stickiedUnanswered
  • Forum posts: 6

Apr 19, 2016, 10:59:39 PM via Website

I have an API response that I need to show on my listView. At the beginning It starts off with 15 items, and I want to add more as the user scrolls down and reaches the end of the list. Unfortunately I am a beginner an I can't get very far with code. Please help! Any help would be appreciated.

— modified on Apr 19, 2016, 11:02:20 PM

  • Forum posts: 6

Apr 20, 2016, 2:21:03 PM via Website

public class StreamingAdapter extends BaseAdapter {

private Context context;
private int resource;
private LayoutInflater inflater;
private List<StreamingOffer> streamingOfferList;
private List<StreamingOffer> updatedlist;

public StreamingAdapter(Context context, int resource, Response<ResponseResult> response, Response<ResponseResult> updatedresponse) {


    streamingOfferList = response.body().getData();
    updatedlist = updatedresponse.body().getData();


— modified on Apr 20, 2016, 2:23:28 PM

  • Forum posts: 211

Apr 21, 2016, 8:05:49 AM via Website

ok no issue. so what you can do

let say first the app called the web service and server returns the response. now you have the response and you added it in the list. (Assuming that you are using the ListView). In list there is a callback method "onScrollDown" that will tell you that the list is scrolled to bottom. When you got this call back again call the webservice (like first your counter was 0 to 15 and now the counter will 15 to 30) and add the response to the list. Every time you counter will increase respectively.

And also if any issue will occur let us know with brief detail so can try to resolve it.

  • Forum posts: 6

Apr 21, 2016, 8:29:50 AM via Website

The thing is I have a new response but I dont know how to add it to the list (the adapter) How do i do that in code?

  • Forum posts: 6

Apr 21, 2016, 9:20:02 AM via Website


Here you can see what I've done so far
How do i add nextpage url dynamically?

— modified on Apr 21, 2016, 10:04:53 AM

  • Forum posts: 6

Apr 21, 2016, 9:25:59 AM via Website

The pagination works, but only loads old items all over again

— modified on Apr 21, 2016, 10:05:51 AM

Recommended by NextPit