disable if no more items
I am working on getting this implemented into my app and I don't see if there is a way to disable this once someone has gotten to the bottom of the list. When that happens, I see in my android monitor it gets called repeatedly an unlimited number of times as long as the user near the bottom of the list. Is there a way to turn it off once the last items have been loaded in, or should I just set the variable to null?
In my apps, What I did was if the returned list size is less than required list size, then I made a page number negative. before sending server request I'm checking if page number is only positive.
It may not be good idea to turn it off. Because if user wants to refresh list, you have to turn it on again.
If you want to remove the listener you can use
mRecyclerView.removeOnScrollListener(infiniteScrollListener);
and add again using
mRecyclerView.addOnScrollListener(infiniteScrollListener);
if you are using it with adapterviews mListView.setOnScrollListener(null) will remove the listener and mListView.setOnScrollListener(mListener) will add it again