java – How to know that last recyclerView item of first or current screen/page is loaded, any Callbacks but gets called once?-ThrowExceptions

Exception or error:

I am using a grid layout of recyclerView and have tried several options using either onLayoutCompled methods and also by onScollListner methods, tried this answer but it’s stiil calling multiple times as each item keeps loading, nothing is working.

Just want to detect the last recyclerView item of the particular screen is completely loaded or visible to the user according to their screen size Or we can say that when the user’s current screen is full of the recyclerView Items, any way to detect that? ANd should be called only once. Any help would be great.
Thank you for your valuable time.

How to solve:

You can use a Sharedpref value which can be set to true in your onScrollStateChanged method based on your condition.

public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
   super.onScrollStateChanged(recyclerView, newState);

   if (newState != RecyclerView.SCROLL_STATE_IDLE) {

   boolean isLastPositionVisible = mFollowingLayoutManager.findLastVisibleItemPosition() == getList().size() - 1

   if(isLastPositionVisible && getSharedPrefValue()) {
      // Call your method
      // Set sharedpref value to true.


Leave a Reply

Your email address will not be published. Required fields are marked *