I have my database in firebase and I want you to return the data of 10 in 10 every time you press a button. How can I do this?? I am programming in android studio and I am new in this of firebase Thank you very much ...
What you are trying to do is called page. Try the following
mOffset = 0;
mPageSize = 10;
mOffset += mPageSize;
mQuery = mDatabase.child("TU_PATH_FIREBASE")
.limitToFirst(mPageSize)
.startAt(mOffset);
In summary, mPageSize
indicate how many items you want to read (field limitToFirst
)
The mOffset
helps you to know how many items you have already read. When it is your first reading, mOffset
is 0 and you will read from 0 to 9, and in your second reading, you must increase that value to 10 (page size) so that it reads from 10 to 19 and so on