URL1:从Facebook获取图片的网址:http://graph.facebook.com/ {fb-user-id}/picture?type = large
URL2:URL1被点击时重定向的URL https://fbcdn-profile-a.akamaihd.net/hprofile-ak-prn1/t5.0-1/371818_100002856860463_136071413_n.jpg
Facebook个人资料图片未显示在图片视图android中.这可能是因为从facebook获取图像的url即URL1重定向到某个其他位置以提供图像.当我直接使用重定向的URL即URL2加载图像时,它工作正常.
获取位图的代码:
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();
}
Run Code Online (Sandbox Code Playgroud)
我已经google了很多,我得到了stackoverflow本身的一些答案(可能是一个可能重复),但没有得到任何可以解决这个问题的答案.提前致谢.