In my Android app I am using this code to retrieve posts from firebase database:
ArrayList<Post> posts = new ArrayList<>();
dbRef.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
for(DataSnapshot dsp : dataSnapshot){
String author = dsp.child("author").getValue().toString();
String text = dsp.child("author").getValue().toString();
posts.add(new Post(author,text));
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
But this returns all the posts and if there would be many of them I think it wouldn't be good idea to keep them all in memory. Is there a way to get only certain number of node's children? For example at the beginning I would like to get 10 first ones, then 10 more and so on