title: Firebase database Query StartAt() Not Working?
body: <p><strong>So I have been trying to paginate my Recyclerview so whenever the recyclerView reaches to the bottom of the screen I will call addNewPosts method</strong></p>
  <p>Here the <strong>lastItemId</strong> is the last id of the view that has been retrieved from the firebase.</p>
  <p>I checked it, it is not null and giving the correct node that is at the bottom of the screen.</p>
  <p><strong>Method</strong></p>
  <pre><code>private void addNewPost(String lastItemId) {
  
      Query ref = FirebaseDatabase.getInstance()
              .getReference(&quot;Admin&quot;).child(mAuth.getUid()).child(&quot;INSTITUTE&quot;)
              .child(&quot;PROGRAMMES&quot;).orderByChild(&quot;programmeName&quot;);
  
  
      ref.startAt(lastItemId).limitToFirst(6).addChildEventListener(new ChildEventListener() {
          @Override
          public void onChildAdded(@NonNull DataSnapshot snapshot, @Nullable String previousChildName) {
  
              StyleableToast.makeText(Programme_students.this, &quot;ca&quot;, R.style.exampleToast).show();
  
              // retreiving the data of hte students
              String _icon = snapshot.child(&quot;PROGRAMMEINFORMATION&quot;).child(&quot;programmeIcon&quot;).getValue().toString();
              String _programmeName = snapshot.child(&quot;PROGRAMMEINFORMATION&quot;).child(&quot;programmeName&quot;).getValue().toString().toUpperCase();
              String _programmeCode = snapshot.child(&quot;PROGRAMMEINFORMATION&quot;).child(&quot;programmeCode&quot;).getValue().toString();
  
  
              // creating a object of students
              ProgrammeHelper programmeHelperzzz = new
                      ProgrammeHelper(_icon, _programmeName, _programmeCode);
  
              //adding the stuents to the global variable
              programmesfromdatabase.add(programmeHelperzzz);
  
              progressBar.setVisibility(View.GONE);
  
              programme_adapter.notifyDataSetChanged();
  
              settinglistviewwwwwww();
  
          }
  
          @Override
          public void onChildChanged(@NonNull DataSnapshot snapshot, @Nullable String previousChildName) {
  
          }
  
          @Override
          public void onChildRemoved(@NonNull DataSnapshot snapshot) {
  
          }
  
          @Override
          public void onChildMoved(@NonNull DataSnapshot snapshot, @Nullable String previousChildName) {
  
          }
  
          @Override
          public void onCancelled(@NonNull DatabaseError error) {
  
          }
      });
  
  }
  </code></pre>
  <p><strong>So there is a Custom toast called Stylabletoast  just to confirm I kept it there so the toast is not being shown the Method is not being called when I keep the StartAt() function</strong></p>
  <p><strong>As soon i remove the StartAt() the code works it gives me all the new posts but it duplicates Because it is starting from the start</strong></p>