-
Notifications
You must be signed in to change notification settings - Fork 349
Pagination
When you ask for photos, albums and other list of entities, you will get the first page of results. Usualy it is 25 first results.
For getting next or previous pages you can use methods below or get Cursor
and start iterating.
Each OnActionListener
has next methods:
-
hasNext()
- returntrue
if one more page exists -
hasPrev()
- returntrue
if previous page exists -
getNext()
- execute request for getting next page and the results return to the same listener -
getPrev()
- execute request for getting previous page and the results return to the same listener -
getCursor()
- returnCursor
which has the same methods above
Let's say we are asking for comments by: getCommets(entityId, onCommentsListener)
.
We want to check if there is more pages with comments. If so, we will ask for more.
And this is our listener:
OnCommentsListener onCommentsListener = new OnCommentsListener() {
@Override
public void onComplete(List<Comment> comments) {
Log.i(TAG, "Number of comments = " + comments.size());
if (hasNext()) {
getNext();
}
}
};
Of course, it is just an example. In your app, you will maybe add a button that will say 'get more...' and then you will actually call for
getNext()
but it is up to you how to handle it. You cangetCursor()
and iterate to the next pages from other place in you app. Again, it's up to you :)
-
Setup
-
Login/Logout
-
Publish
-
Requests/Invite
-
Get
-
Additional options 🔻
-
Samples