title: Pagination using Parse and RecyclerView
body: <p>I have been trying to look at various other questions for help however I cannot seem to be able to find a solution.</p>
  
  <p>OnScrollListener that I am using: <a href="https://gist.github.com/ssinss/e06f12ef66c51252563e" rel="nofollow">https://gist.github.com/ssinss/e06f12ef66c51252563e</a></p>
  
  <p><code>
  rvHome.addOnScrollListener(new MainRecyclerViewScrollListener(linearLayoutManager) {
              @Override
              public void onLoadMore(int page) {
                  fetchPosts(page);
              }
          });
  </code>
  <code></p>
  
  <pre><code>public void fetchOfflinePosts() {
      offlineListPosts = db.getAllPosts();
  
      for (Post post : offlineListPosts) {
          listPosts.add(post);
      }
  
      postAdapter.notifyDataSetChanged();
  }
  
  public void loadPosts() {
  
      if (ConnectivityHelper.isConnected(getContext())) {
          db.deleteAllPosts();
          listPosts.clear();
          fetchPosts(0);
      } else {
          swipeRefreshLayout.setRefreshing(false);
      }
  
  }
  
  public void fetchPosts(int skip) {
      ParseQuery&lt;ParseObject&gt; findPostsRequest = new ParseQuery&lt;&gt;("Post");
      findPostsRequest.setSkip(skip);
      findPostsRequest.orderByDescending("createdAt");
      findPostsRequest.findInBackground(new FindCallback&lt;ParseObject&gt;() {
          @Override
          public void done(List&lt;ParseObject&gt; posts, ParseException e) {
  
              if (e == null) {
                  for (ParseObject _post : posts) {
                      final Post post = new Post();
  
                      String objectId = _post.getObjectId();
                      String username;
                      String imageUrl;                      
  
                      if (_post.getString("username") != null) {
                          username = _post.getString("username");
                      } else {
                          username = "";
                      }
  
                      ParseQuery&lt;ParseUser&gt; findProfilePicQuery = ParseUser.getQuery();
                      findProfilePicQuery.whereEqualTo("username", username);
                      findProfilePicQuery.findInBackground(new FindCallback&lt;ParseUser&gt;() {
                          @Override
                          public void done(List&lt;ParseUser&gt; users, ParseException e) {
  
                              if (e == null) {
                                  for (ParseUser user : users) {
  
                                      if (user.getParseFile("profilePic") != null) {
                                          post.setProfilePicUrl(user.getParseFile("profilePic").getUrl());
                                      } else {
                                          post.setProfilePicUrl("");
                                      }
  
                                  }
                              }
  
                          }
                      });
  
                      if (_post.getParseFile("photo") != null) {
                          imageUrl = _post.getParseFile("photo").getUrl();
                      } else {
                          imageUrl = "";
                      }
  
                      post.setObjectId(objectId);
                      post.setUsername(username);
                      post.setImageUrl(imageUrl);
  
                      db.addPost(post);
                  }
  
                  fetchOfflinePosts();
                  swipeRefreshLayout.setRefreshing(false);
              }
  
          }
      });
  }
  </code></pre>
  
  <p></code>
  By using the code above I can get the RecyclerView to load more items once the last item is reached but the posts fetched are the same as the ones I have already got. I know I'm getting something really simple wrong. Any help would be much appreciated.</p>