使用Facebook的SDK 3.0为Android检索资料图片资料、图片、SDK、Facebook

2023-09-06 02:03:05 作者:你头发乱了哦

我已经与Facebook SDK 3.0的Andr​​oid以下问题。 我想获得我(和我的朋友),而不使用自己的ProfilePictureView部件的个人资料图片,因此,如果我用图形浏览器我看到JSON响应为:

I've following problem with Facebook SDK 3.0 for Android. I wanna get my (and my friends) profile picture without using their ProfilePictureView widget, so if I use Graph Explorer I see that Json response is:

{
   "data": {
         "url": "https://fbcdn-profile-a.akamaihd.net/hprofile-ak-ash4/372127_1377011138_1538716206_q.jpg", 
         "is_silhouette": false
    }
}

我需要网址路径来下载并显示图像,但具有下列code:

I need that "url" path to download and show the picture, but with the following code:

Request.executeGraphPathRequestAsync(Session.getActiveSession(), 
                                     "me/picture", 
                                      new Request.Callback() {
        @Override
        public void onCompleted(Response response) {
            GraphObject go = response.getGraphObject();
            Log.i("APP_NAME", go.toString());           
        }
});

我得到这样的:

I obtain this:

GraphObject{graphObjectClass=GraphObject, 
    state={"FACEBOOK_NON_JSON_RESULT":"����\u0000\u0010JFIF\u0000\u0001\u0001\u0000\u0000\u0001\u0000\u0001\u0000\u0000��\u0000"}}

有人能帮助我吗? 谢谢

Someone can help me please? Thanks

Cromir

推荐答案

这是更简单的方法是将执行 GET 要求 graph.facebook .COM / USER_ID /图片,所以你不必第一个请求的URL的图片,然后执行另一个 GET 请求下载图片从给定的URL。

An easier way would be to execute a GET request to graph.facebook.com/USER_ID/picture so you don't have to first request an URL to the picture, and then execute another GET request to download the picture from the given URL.

而不是 Request.executeGraphPathRequestAsync 的使用,只是做一个正常的 GET 请求URL上面,如 http://graph.facebook.com/4/picture

Instead of using Request.executeGraphPathRequestAsync, just do a normal GET request to the URL above, e.g. http://graph.facebook.com/4/picture.