title: How to use nextPageToken from youtube data api v3 to load more videos in android recycler view
body: <p>I'm building an application where I have an Recycler View which has my YouTube channel videos. Everything works fine. I get my first 10 results successfully .but now when user scrolls down and reaches 10th result I want to load next 10 results,</p>
  
  <p>my json response has nextPageToken but i dont know how to use nextPageToken to load next page videos in my recycler view, 
  Any help ?</p>
  
  <pre><code>  https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&amp;maxResults=10&amp;playlistId=PLWz5rJ2EKKc_XOgcRukSoKKjewFJZrKV0&amp;fields=nextPageToken,items(id,snippet(title,description,position,thumbnails(medium,high),resourceId/videoId))&amp;key=API_KEY;    
  </code></pre>
  
  <p>json parsing code :</p>
  
  <pre><code>    private ArrayList&lt;VideoData&gt; parseJSONReaponse(JSONObject response) {
      ArrayList&lt;VideoData&gt; listVideos = new ArrayList&lt;&gt;();
      if (response != null || response.length() &gt; 0) {
  
          String nextPageToken = Constants.NA;
          try {
  
              if (response.has(KEY_NEXTPAGETOKEN)
                      &amp;&amp; !response.isNull(KEY_NEXTPAGETOKEN) ){
                  nextPageToken = response.getString(KEY_NEXTPAGETOKEN);
              }
  
              JSONArray arrayItems = response.getJSONArray(KEY_ITEMS);
  
              for (int i = 0; i &lt; arrayItems.length(); i++) {
                  String title = Constants.NA;
                  String urlThumbnail = Constants.NA;
                  String resourceID = Constants.NA;
  
                  JSONObject currentItems = arrayItems.getJSONObject(i);
  
                  if (currentItems.has(KEY_SNIPPET)
                          &amp;&amp; !currentItems.isNull(KEY_SNIPPET)) {
                      JSONObject objectSnippet = currentItems.getJSONObject(KEY_SNIPPET);
  
                      if (objectSnippet.has(KEY_TITLE)
                              &amp;&amp; !objectSnippet.isNull(KEY_TITLE)) {
                          title = objectSnippet.getString(KEY_TITLE);
                      }
  
                      if (objectSnippet.has(KEY_THUMBNAIL)
                              &amp;&amp; !objectSnippet.isNull(KEY_THUMBNAIL)) {
                          JSONObject objectThumbnail = objectSnippet.getJSONObject(KEY_THUMBNAIL);
  
  
                          if (objectThumbnail.has(KEY_THUMBNAIL_MEDIUM)
                                  &amp;&amp; !objectThumbnail.isNull(KEY_THUMBNAIL_MEDIUM)) {
                              JSONObject objectThumbnailMedium = objectThumbnail.getJSONObject(KEY_THUMBNAIL_MEDIUM);
  
  
                              if (objectThumbnailMedium.has(KEY_THUMBNAIL_MEDIUM_URL)
                                      &amp;&amp; !objectThumbnailMedium.isNull(KEY_THUMBNAIL_MEDIUM_URL)) {
                                  urlThumbnail = objectThumbnailMedium.getString(KEY_THUMBNAIL_MEDIUM_URL);
                              }
                          }
                      }
  
                      if (objectSnippet.has(KEY_RESOURCEID)
                              &amp;&amp; !objectSnippet.isNull(KEY_RESOURCEID)) {
                          JSONObject objectResourceId = objectSnippet.getJSONObject(KEY_RESOURCEID);
  
                          if (objectResourceId.has(KEY_VIDEOID)
                                  &amp;&amp; !objectResourceId.isNull(KEY_VIDEOID)) {
                              resourceID = objectResourceId.getString(KEY_VIDEOID);
                          }
                      }
                  }
  
                  VideoData videoData = new VideoData();
                  videoData.setTitle(title);
                  videoData.setUrlThumbnail(urlThumbnail);
                  videoData.setVideoId(resourceID);
  
                  if (!title.equals(Constants.NA)){
                      listVideos.add(videoData);
                  }
  
              }
  
          } catch (JSONException e) {
              e.printStackTrace();
          }
      }
      return listVideos;
  }
  </code></pre>