2014-07-10 71 views
0

當我試圖從facebook url獲取位圖圖像時,它顯示位圖爲null。這是我的代碼。Android - BitMap Null來自URL

URL url = new URL("http://graph.facebook.com/100006480449004/picture?type=large"); 
HttpURLConnection connection = (HttpURLConnection) url.openConnection(); 
connection.setDoInput(true); 
connection.connect(); 
InputStream input = connection.getInputStream(); 
Bitmap myBitmap = BitmapFactory.decodeStream(input); 
+0

重定向顯然有此重定向。你可能需要告訴httpUrlConnection來關注它。 – njzk2

回答

0

輸入網址到瀏覽器,這會轉發您到PIC的正確網址,在.jpg

結束或者你啓用通過connection.setInstanceFollowRedirects(true);