How to use the Facebook Graph Api Cursor-based Pagination

后端 未结 5 2327
南旧
南旧 2021-02-13 10:15

I didn\'t find any help on this topic. The Docs say

Cursor-based pagination is the most efficient method of paging and should always be used where possibl

5条回答
  •  一生所求
    2021-02-13 10:58

    Do not reinvent the wheel.

    GraphResponse class already has a convenient method for paging. GraphResponse.getRequestForPagedResults() returns GraphRequest object, and you can use that object for paging.

    Also I found code snippet from facebook-android-sdk's unit test code.

    GraphRequest nextRequest = response.getRequestForPagedResults(GraphResponse.PagingDirection.NEXT);
    nextRequest.setCallback(request.getCallback());
    response = nextRequest.executeAndWait();
    

提交回复
热议问题