Answer the question
In order to leave comments, you need to log in
How to understand in RecyclerView on Android that it has reached the end of the list?
How to understand in RecyclerView on Android that it has reached the end of the list? In the ListView I did this:
public void onScroll(AbsListView absListView, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
boolean loadMore = firstVisibleItem + visibleItemCount >= totalItemCount;
if (loadMore && !getLoaderManager().hasRunningLoaders()) {
getLoaderManager().restartLoader(LOADER_ID);
}
}
Answer the question
In order to leave comments, you need to log in
In the adapter class I wrote the following code
@Override
public void onBindViewHolder(ViewHolder viewHolder, int position) {
Item item = mItems.get(position);
viewHolder.Text.setText(item.getTitle());
if (position == mItems.size() - 1) {
mListener.onListEnded();
}
}
Use the LayoutManager there are methods to get the position of the elements on the screen
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question