0
我想在我的imageview中顯示來自互聯網的圖像。位圖大小超過VM預算,同時從互聯網加載圖像?
這是提高以下錯誤的任何一個指導我我在這裏做什麼錯誤
公共位圖DisplayLiveImage(字符串ImageSrc) { 位圖BM; 嘗試{
URL aURL = new URL(ImageSrc);
URLConnection conn = aURL.openConnection();
conn.connect();
InputStream is = null;
try
{
is= conn.getInputStream();
}catch(IOException e)
{
return null;
}
BufferedInputStream bis = new BufferedInputStream(is);
bm = BitmapFactory.decodeStream(bis);
bis.close();
is.close();
} catch (IOException e) {
return null;
}
return bm;
}
logcat的
11-12 21:45:22.509: ERROR/AndroidRuntime(7118): java.lang.OutOfMemoryError: bitmap size exceeds VM budget
11-12 21:45:22.509:
ERROR/AndroidRuntime(7118): at android.graphics.BitmapFactory.nativeDecodeStream(Native Method)
11-12 21:45:22.509:
ERROR/AndroidRuntime(7118): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:476)
11-12 21:45:22.509:
ERROR/AndroidRuntime(7118): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:537)
11-12 21:45:22.509:
ERROR/AndroidRuntime(7118): at com.Finditnear.FindItNearActivityWithoutMenu.DisplayLiveImage
(FindItNearActivityWithoutMenu.java:149)
11-12 21:45:22.509: ERROR/AndroidRuntime(7118): at com.Finditnear.ViewSingleImage$1.run
(ViewSingleImage.java:88)
任何幫助,將不勝感激。