title: Load More RecyclerView and Bottom ProgressBar
body: <h2>How to implement setOnScrollListener in RecyclerView</h2>
  
  <p>Hi I am new in android , i have a query regarding lode more on infinite scroll , Please give me some ways to resolve my Query .</p>
  
  <p>I have this function  <code>mAdapter.setOnLoadMoreListener(new OnLoadMoreListener()</code>   and i want to put some integer like 1 , 2 and after that next 20 data will automatically shown form server .</p>
  
  <p>My code is shown below :- </p>
  
  <pre><code>  @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container,
                               Bundle savedInstanceState) {
          View rootView = inflater.inflate(R.layout.latest_upload_ten, container, false);
          handler = new Handler();
          recyclerView = (RecyclerView) rootView.findViewById(R.id.my_recycler_view);
          recyclerView.setHasFixedSize(true);
          layoutManager = new LinearLayoutManager(getActivity());
          recyclerView.setLayoutManager(layoutManager);
          progressBar = (ProgressBar) rootView.findViewById(R.id.progress_bar);
          return rootView;
      }
  
  
      public static void setAdapter(final Context context) {
          if (recyclerView != null)
              recyclerView.setVisibility(View.VISIBLE);
          Settings.loading = false;
          Utils.e("MessageFragment 106", "setAdapter ok");
          mAdapter = new TopRankedAdapter(adapterList, recyclerView, R.layout.video_items, 1);
          Utils.e("MessageFragment 109", "setAdapter ok");
          recyclerView.setAdapter(mAdapter);
          Utils.e("MessageFragment 109", "setAdapter ok");
  
          mAdapter.setOnLoadMoreListener(new OnLoadMoreListener() {
              @Override
              public void onLoadMore() {
                  //add null , so the adapter will check view_type and show progress bar at bottom
                  adapterList.add(null);
                  mAdapter.notifyItemInserted(adapterList.size() - 1);
                  ++pageNumber;
                  Log.e("ee","dd"+pageNumber);
  
             }
  
          });
  
  
      }
  
      public static void loadData(Context context, List&lt;HashMap&lt;String, Object&gt;&gt; viewList, String mode) {
          Utils.e("TopRankedFragment144", "loadData");
          Utils.e("mode= ", "www "+mode);
          if (viewList != null &amp;&amp; viewList.size() &gt; 0) {
              try {
                  if (adapterList == null) {
                      Utils.e("TopRankedFragment148", "TopRankedFragmentList else");
                      adapterList = new ArrayList&lt;OfficeData&gt;();
  
                  } else {
                      adapterList.clear();
                  }
                  for (int i = 0; i &lt; viewList.size(); i++) {
                      HashMap&lt;String, Object&gt; mp = new HashMap&lt;String, Object&gt;();
                      mp = viewList.get(i);
                      Utils.e("TopRankedFragment157", "i " + i);
                      if (!adapterList.contains(mp))
                          adapterList.add(new OfficeData(mp, 1));
                  }
              } catch (Exception e) {
                  Utils.e("TopRankedFragment 166", "Exception======================Exception======================Exception");
                  e.printStackTrace();
              } finally {
                  setAdapter(context);
          }}
      }
  </code></pre>
  
  <p>Thanks for your help :)</p>