How to change value and re-trigger eventListener in Firebase?
<p>I am making a public chat app using Firebase Real-time Database, but stuck on this problem. Like normal chat apps, I am displaying only few texts to the user and when/if the user scrolls the List is updated and more messages are displayed. </p>

<p>I have a listener to my Firebase reference, which is only displaying (say 10 messages):</p>

<pre><code>int j = 10;
 myRef.child("Chat").limitToLast(j).addChildEventListener(new com.google.firebase.database.ChildEventListener() {
        @Override
        public void onChildAdded(com.google.firebase.database.DataSnapshot dataSnapshot, String s) {
         //   Map&lt;String,Object&gt; datemsg = (Map&lt;String,Object&gt;)dataSnapshot.getValue();

             Map&lt;String,Object&gt; msg = (Map&lt;String,Object&gt;)dataSnapshot.getValue();


                        String text = msg.get("Text").toString();
                        values.add(text);


        @Override
        public void onChildChanged(com.google.firebase.database.DataSnapshot dataSnapshot, String s) {

        }

        @Override
        public void onChildRemoved(com.google.firebase.database.DataSnapshot dataSnapshot) {

        }

        @Override
        public void onChildMoved(com.google.firebase.database.DataSnapshot dataSnapshot, String s) {

        }

        @Override
        public void onCancelled(DatabaseError databaseError) {

        }
    });
</code></pre>

<p>Now I have a scroll Listener that changes the value for <code>j</code> to <code>j+10</code> but then the ChildEvenListener is not triggered and the new messages are not added to the listview. </p>

<p>I also tried using queries, but again having the same problem, after updating the value, how should I update the adapter? </p>

<p>No new child is added, thus the childevent listener is not triggered, but I want to change the size of </p>

<pre><code>limitToLast(j) 
</code></pre>

<p>and re-populate the list. 
Any help would be appreciated. </p>