I\'m trying to make a chat application, I use Firebase as my backend, I\'m populating my listview onCreate() with the last 10 messages sent, and I just want that when the us
you can use startAt(), endAt(), and equalTo() method. When the user reaches the end of the list then call a method to load more from the server. make sure to implements ValueEventListener.
Query pagination = mDatabase.orderByChild("id").startAt(startAt).endAt(startAt + 10);
pagination.addListenerForSingleValueEvent(this);
I think you can use endAt()
ref.orderByChild("creationDate").limitToLast(pageSize).endAt(oldestLocalMessageTime).addValueEventListener
// pageSize is the number of messages you want to load each time (10)
// oldestLocalMessageTime is the time of oldest message that you have loaded from Firebase
// everytime you load/load more messages you need to update oldestLocalMessageTime value