I am using RecyclerView inside fragment in my activity, the ConstraintLayout below is where the fragment is called, and when i open the app it calls all the data for the RecyclerView which is not open by user.

So i want to call data when user is scrolling or user is viewing the items of RecyclerView 

So is there any way that only first few or 5 post are called and rest are called while scrolling.

Activity XML-

```js
 <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/tv_feed"
            android:text="Feed"
            android:layout_marginLeft="20dp"
            android:layout_below="@+id/rcv_news"
            android:layout_marginBottom="10dp"
            android:textColor="#000000"
            android:paddingLeft="10dp"
            android:textSize="30dp"
            android:fontFamily="@font/benchnine_bold" />

        <androidx.constraintlayout.widget.ConstraintLayout
            android:id="@+id/container"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_below="@+id/tv_feed">

        </androidx.constraintlayout.widget.ConstraintLayout>

    </RelativeLayout>
```

Fragment XML-

```js
<androidx.constraintlayout.widget.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/grey_bg"
    xmlns:app="http://schemas.android.com/apk/res-auto">

    <androidx.recyclerview.widget.RecyclerView
        android:id="@+id/post_ImagesRecyclerView"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_margin="5dp"
        android:background="@color/grey_bg"
        android:nestedScrollingEnabled="false"/>

    <com.wang.avi.AVLoadingIndicatorView.......
```

Java -

```js
postAdapter = new PostAdapter(context, false, false, postList, this, 1, loadType);
        LinearLayoutManager postListManager = new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false);
        post.setLayoutManager(postListManager);
        post.setAdapter(postAdapter);

        postPayload = new PostPayload(CommonData.getCampusId(), start, LIMIT, loadType, CommonData.getCreatorInfo());
        postPayload.setPostId(postId);
        if (postPayload.getLoadType() == Constants.LOAD_MY_POSTS)
            postPayload.setProfileCreatedBy(CommonData.getLoggedInUserId());
        postPayload.setSearchKey(searchKey);

        getPosts();
    }

    @Override
    public void getMorePost() {

        start = postList.size();
        postPayload.setStart(start);
        getPosts();
    }
```