您好我想在我的視圖中顯示存儲在sdcard中的3或4張圖像,圖像大小約爲1-2 MB。 我的問題是,當我使用imageview的圖像,然後扔出去內存異常 我已創建位,並通過選擇解碼圖像爲位圖如何在android中爲imageview壓縮圖像
02-26 13:16:54.946: ERROR/dalvikvm-heap(23410): 15980544-byte external allocation too large for this process.
02-26 13:16:54.946: ERROR/dalvikvm(23410): Out of memory: Heap Size=3407KB, Allocated=2801KB, Bitmap Size=15630KB, Limit=21884KB
02-26 13:16:54.946: ERROR/dalvikvm(23410): Trim info: Footprint=3463KB, Allowed Footprint=3655KB, Trimmed=248KB
02-26 13:16:54.946: ERROR/GraphicsJNI(23410): VM won't let us allocate 15980544 bytes
02-26 13:16:54.986: ERROR/AndroidRuntime(23410): FATAL EXCEPTION: main
02-26 13:16:54.986: ERROR/AndroidRuntime(23410): java.lang.OutOfMemoryError: bitmap size exceeds VM budget
02-26 13:16:54.986: ERROR/AndroidRuntime(23410): at android.graphics.BitmapFactory.nativeDecodeFile(Native Method)
02-26 13:16:54.986: ERROR/AndroidRuntime(23410): at android.graphics.BitmapFactory.decodeFile(BitmapFactory.java:325)
任何機構可以幫助我解決我的問題提前 感謝時
我創建選項BitmapFactory.Options選項= new BitmapFactory.Options(); \t \t \t options.inTempStorage = new byte [16 * 1024]; \t \t \t options.inJustDecodeBounds = false; \t \t \t options.inSampleSize = 8; – 2011-02-26 08:45:20
你是說這解決了你的問題,或者你是否已經失去了記憶? – EboMike 2011-02-26 15:25:47
@EboMike:thanx幫助我。我說它不能解決我的問題,當我在我的代碼中使用BitmapFactory選項時,它仍會拋出OOM異常。 – 2011-02-28 09:44:21