Facebook的个人资料图片没有得到显示在Android的图像视图 [英] Facebook profile image not getting displayed in android image view

查看:156
本文介绍了Facebook的个人资料图片没有得到显示在Android的图像视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  • URL1: URL to get image from facebook: http://graph.facebook.com/{fb-user-id}/picture?type=large

URL2:URL时,在哪里得到URL1击中facebook的重定向<一个href=\"https://fbcdn-profile-a.akamaihd.net/hprofile-ak-prn1/t5.0-1/371818_100002856860463_136071413_n.jpg\" rel=\"nofollow\">https://fbcdn-profile-a.akamaihd.net/hprofile-ak-prn1/t5.0-1/371818_100002856860463_136071413_n.jpg

URL2: URL where the facebook redirects when URL1 get hit https://fbcdn-profile-a.akamaihd.net/hprofile-ak-prn1/t5.0-1/371818_100002856860463_136071413_n.jpg

Facebook的个人主页图像是没有得到显示在图像视图机器人。这可能是因为URL即URL1获得的图像从Facebook重定向到其他位置,使图像。当我使用重定向的URL,即URL2直接加载图像,然后它正常工作。

Facebook profile image is not getting displayed in image view android. That may be because the url i.e. URL1 to get image from facebook redirects to some other location to give the image. When i use the redirected url i.e. URL2 directly to load the image then it it works fine.

code得到位图:

    Bitmap b = null;

    URL url = null;
    try {
        url = new URL(image_path);
        URLConnection dd = url.openConnection();
            b = BitmapFactory.decodeStream(dd.getInputStream());
    } catch (MalformedURLException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }

我用Google搜索了很多,我得到计算器本身(以及可能是一个可能重复的),但并没有得到能够解决这个任何回答一些答案。先谢谢了。

I have googled it a lot and i get some answers on stackoverflow itself (and may be a possible duplicate) but didn't get any answer that can solve this. Thanks in advance.

推荐答案

一些google搜索后,我找到了答案在这里:的 http://www.mkyong.com/java/java-httpurlconnection-follow-redirect-example/

After some googling i found an answer here: http://www.mkyong.com/java/java-httpurlconnection-follow-redirect-example/

这解决了我的问题。

HttpURLConnection的后续重定向只是一个指标,实际上它不会帮你做真正的HTTP重定向你仍然需要手工处理。

The HttpURLConnection‘s follow redirect is just an indicator, in fact it won’t help you to do the "real" http redirection, you still need to handle it manually.

这篇关于Facebook的个人资料图片没有得到显示在Android的图像视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆