通过Graph API URL

时间:2015-07-28 06:08:30

标签: android facebook photos

在Android上我使用Facebook SDK 4.0。我希望通过Facebook登录获取用户登录的所有照片。

我有这个网址

https://graph.facebook.com/FACEBOOK_ID/albums?access_token=TOKEN

如何解析和生成要在ListView中查看的图像?

2 个答案:

答案 0 :(得分:1)

设置Bundle以获取额外参数,例如crate a bundle以获取所需参数ex:

Bundle parameters = new Bundle();
parameters.putString("fields", "id, picture");

然后将其设置为GraphRequest

答案 1 :(得分:0)

您必须使用以下代码来获取用户的所有照片。

/* make the API call */
new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "/{user-id}/photos",
    null,
    HttpMethod.GET,
    new GraphRequest.Callback() {
        public void onCompleted(GraphResponse response) {
            /* handle the result */
        }
    }
).executeAsync();