Reputation: 2191
How to add customListView
items to the EndlessAdapter
through the add
method? Once a new instance of the CustomListViewAdapter
is instanciated with the constructor of the EndlessAdapter
i need to add elements to my list otherwise it will just recycle old elements.
Upvotes: -1
Views: 62
Reputation: 7376
you can try this:
@Override
public void onScroll(AbsListView view, int firstVisibleItem,
int visibleItemCount, int totalItemCount) {
if ( scroll&&list.getLastVisiblePosition() == list.getAdapter().getCount() - 1
&& list.getChildAt(list.getChildCount() - 1).getBottom() <= list.getHeight()) {
//add your new elements
}
}
you can add your new items in your last element of your listview, you can load your listview 10 and when a user comes to last element of list it load 10 items again
Upvotes: 0