Possible Duplicate:
Android: Strange out of memory issue while loading an image to a Bitmap object的OutOfMemoryError:位圖大小超過VM預算: - 安卓
我是從網址下載圖片並顯示它們。在下載時,它給予out of memory error : bitmap size exceeds VM budget
。我使用drawable。代碼如下:
HttpClient httpclient= new DefaultHttpClient();
HttpResponse response=(HttpResponse)httpclient.execute(httpRequest);
HttpEntity entity= response.getEntity();
BufferedHttpEntity bufHttpEntity=new BufferedHttpEntity(entity);
InputStream instream = bufHttpEntity.getContent();
Bitmap bm = BitmapFactory.decodeStream(instream);
Bitmap useThisBitmap = Bitmap.createScaledBitmap(bm,bm.getWidth(),bm.getHeight(), true);
bm.recycle();
BitmapDrawable bt= new BitmapDrawable(useThisBitmap);
System.gc();
以下是錯誤:05-28 14:55:47.251: ERROR/AndroidRuntime(4188): java.lang.OutOfMemoryError: bitmap size exceeds VM budget
圖像有多大? – 2010-05-28 09:54:10
嗨,, Marcelo Cantos !!! ..高度和圖像的寬度= 320x320 – Andy 2010-05-28 10:09:28
找出你有多少種方式可以獲取圖像,以便你找不到內存問題 – 2010-05-28 10:23:13