我越來越MalformedURLException:協議未找到,當我試圖從URL加載圖像刺。當我粘貼該URL時,該圖像在瀏覽器中顯示。但不能在ImageView中顯示。我用這個代碼:獲取MalformedURLException:找不到協議?
public static Bitmap getBitmapFromURL(String src) {
try
{
URL url = new URL(src);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setDoInput(true);
connection.connect();
InputStream input = connection.getInputStream();
Bitmap myBitmap = BitmapFactory.decodeStream(input);
return myBitmap;
}
catch (IOException e) {
e.printStackTrace();
return null;
}
}
請有人告訴我最新的問題?這對我很有幫助。
你能告訴我們你的圖片網址嗎? – MByD 2012-04-11 04:59:18
難道你不想錯過':'? – MByD 2012-04-11 05:03:01
感謝大家的支持 – 2012-04-11 05:12:06