0
我從Facebook SDK獲取配置文件圖像,它會返回我url
。當我在瀏覽器中打開它時,會顯示圖像。但是當我將它轉換成位圖時,它會返回null。這裏是我的代碼:圖片URL的位置
String id = user.getId();
try {
URL image_path = new URL("http://graph.facebook.com/"+ id+ "/picture?type=large");
Bitmap profPict = BitmapFactory.decodeStream(image_path.openConnection().getInputStream());
System.out.println("profPict::> " + profPict);
ImageView img= (ImageView)findViewById(R.id.textView2);
img.setImageBitmap(profPict);
System.out.println("image::> " + image_path);
}
catch (Exception e) {
e.printStackTrace();
}
使用此鏈接 [1]:http://stackoverflow.com/questions/19175133/how-to-set-a-image-to-a-image-view-from-a-url-安卓 – Minp 2015-03-25 06:07:14