title: Paginate the Firestore Values in Order
body: <p>I have this <strong>Cloud Firestore Database</strong> &amp; to access it I use:</p>
  <pre><code>CollectionReference robDetails = db.collection(&quot;ROBOTS&quot;).document(RobotA).collection(RobotB);
  </code></pre>
  <p><a href="https://i.stack.imgur.com/FM2E0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FM2E0.png" alt="Image" /></a>
  Each of this &quot;<strong>Connections</strong>&quot; contains two fields (<em>ConnectionType</em> &amp; <em>ConnectionTime</em>) with values.</p>
  <p>I want to load <strong>Connections</strong> ordering by ConnectionTime (the latest at the bottom like shown in the next picture) but only want to show 3 last connections and when user scrolls up show 3 more above the previous ones with the help of SwipeRefreshLayout:</p>
  <p><a href="https://i.stack.imgur.com/RTH6N.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RTH6N.png" alt="Picture" /></a></p>
  <p>The code I currently have to load all the connections like the previous picture is:</p>
  <pre><code> private void loadConnections() {
      CollectionReference loadConnect = db.collection(&quot;ROBOTS&quot;).document(RobotA).collection(RobotB);
      loadConnections.orderBy(&quot;connectionTime&quot;, Query.Direction.ASCENDING).addSnapshotListener(new EventListener&lt;QuerySnapshot&gt;() {
          @Override
          public void onEvent(@Nullable QuerySnapshot queryDocumentSnapshots, @Nullable FirebaseFirestoreException e) {
              
              for (DocumentChange documentChange : queryDocumentSnapshots.getDocumentChanges()) {
                  Connections connection = documentChange.getDocument().toObject(Connections.class);
  
                  mConnectionsList.add(connection);
                  mAdapter.notifyDataSetChanged();
  
                  conRecyclerView.scrollToPosition(mConnectionsList.size() - 1);
                  conSwipeRefresh.setRefreshing(false);
              }
          }
      });
  }
  </code></pre>
  <p><strong>TL;DR:</strong>
  I want to load inside my RecyclerView the Part1 first and when the user scrolls up load Part2, when user scrolls up load Part3... with SwipeRefreshLayout.</p>