我正在構建一個應用程序,獲取facebook用戶的圖像。我已解析返回的JSONObject,提取圖像的URL並將它們加載到GridView中。getRequestForPagedResults方法後GraphRequest爲空
問題是,JSONObject有鏈接到第二頁來獲取剩餘的圖像。
這是我的代碼:
final GraphRequest.Callback graphCallback = new GraphRequest.Callback(){
@Override
public void onCompleted(GraphResponse response) {
jsonObject = response.getJSONObject();
GraphRequest newRequest = response.getRequestForPagedResults(GraphResponse.PagingDirection.NEXT);
JSONObject object = request.getGraphObject();
}
};
Bundle parameters = new Bundle();
parameters.putString("fields", "images");
parameters.putString("limit", "50");
Bundle tagged = new Bundle();
tagged.putString("type", "tagged");
final GraphRequest request = new GraphRequest(AccessToken.getCurrentAccessToken(), "/" + profile.getId() + "/photos", tagged,
HttpMethod.GET, graphCallback
);
request.setParameters(parameters);
request.executeAsync();
這裏是newRequest的值:
{請求:的accessToken:{的accessToken令牌:ACCESS_TOKEN_REMOVED權限:> [user_friends,user_photos,public_profile] },graphPath:null,graphObject:null,httpMethod:GET,參數:Bundle [{}]}
而JSONObject「object」的值是:
空
如何使用FacebookSDK
感謝您的幫助來實現分頁!