title: Infinite scrollview firebase realtime database error
body: <p>im trying to implement an infinite scroll on my listview to load 10 posts more after scroll down and must hold the last 10 on screen because i dont have a button to back to the previous list, managed to retrieve the data, but when i try to scroll down to retrieve the next 10, it crash and give this error.</p>
  <pre><code>SearchRef = FirebaseDatabase.getInstance().getReference().child(&quot;Normas&quot;);
  
  
      if (user != null) {
          getThreads();
          threadsListView.setOnScrollListener(new AbsListView.OnScrollListener() {
              private int currentVisibleItemCount;
              private int currentScrollState;
              private int currentFirstVisibleItem;
              private int totalItem;
              private LinearLayout lBelow;
  
  
              @Override
              public void onScrollStateChanged (AbsListView view,int scrollState){
                  // TODO Auto-generated method stub
                  this.currentScrollState = scrollState;
                  this.isScrollCompleted();
              }
  
              @Override
              public void onScroll (AbsListView view,int firstVisibleItem,
                                    int visibleItemCount, int totalItemCount){
                  // TODO Auto-generated method stub
                  this.currentFirstVisibleItem = firstVisibleItem;
                  this.currentVisibleItemCount = visibleItemCount;
                  this.totalItem = totalItemCount;
  
  
              }
  
              private void isScrollCompleted () {
                  if (totalItem - currentFirstVisibleItem == currentVisibleItemCount
                          &amp;&amp; this.currentScrollState == SCROLL_STATE_IDLE) {
                      /** To do code here*/
                      SearchRef.orderByKey().startAt(oldestPostId).limitToLast(10).addListenerForSingleValueEvent(new ValueEventListener() {
                          @Override
                          public void onDataChange(DataSnapshot dataSnapshot) {
                              for (DataSnapshot child : dataSnapshot.getChildren()) {
                                  MessageThread messageThread = child.getValue(MessageThread.class);
                                  if (messageThread != null) {
                                      oldestPostId = child.getKey();
                                      messageThread.thread_id = child.getKey();
                                      Log.d(TAG, &quot;onDataChange: &quot; + messageThread.toString());
                                  }
                              }
                          }
  
                          @Override
                          public void onCancelled(DatabaseError databaseError) {
  
                          }
                      });
  
                  }
              };
  
          });
      }
  
  
  
  public void getThreads() {
      SearchRef.limitToLast(10).addValueEventListener(new ValueEventListener() {
          @Override
          public void onDataChange(DataSnapshot dataSnapshot) {
              Query ordenar = mDatabase.child(&quot;Normas&quot;).orderByChild(&quot;countthreads&quot;);
              threadsList.clear();
              for (DataSnapshot messageThreadSnapshot : dataSnapshot.getChildren()) {
                  MessageThread messageThread = messageThreadSnapshot.getValue(MessageThread.class);
                  if (messageThread != null) {
                      dataSnapshot.getChildrenCount();
                      messageThread.thread_id = messageThreadSnapshot.getKey();
                      Log.d(TAG, &quot;onDataChange: &quot; + messageThread.toString());
                  }
                  threadsList.add(messageThread);
              }
              threadsAdapter = new ThreadsAdapter(ThreadsActivity.this, R.layout.threads_listview, threadsList, ThreadsActivity.this, ordenar);
              Collections.reverse(threadsList);
              threadsListView.setAdapter(threadsAdapter);
  
          }
          @Override
          public void onCancelled(DatabaseError databaseError) {
              Toast.makeText(ThreadsActivity.this, &quot;ThreadsActivity: &quot; + databaseError.getMessage(), Toast.LENGTH_SHORT).show();
          }
      });
  }
  </code></pre>
  <p>and this is the log after crash :</p>
  <blockquote>
  <p>java.lang.IllegalArgumentException: You must use startAt(String value), endAt(String value) or equalTo(String value) in combination with orderByKey(). Other type of values or using the version with 2 parameters is not supported</p>
  </blockquote>