OutofMemoryError: bitmap size exceeds VM budget (Android)

后端 未结 9 728
甜味超标
甜味超标 2020-11-27 18:48

Getting an Exception in the BitmapFactory. Not sure what is the issue. (Well I can guess the issue, but not sure why its happening)

ERROR/AndroidRuntime(7906): jav         


        
9条回答
  •  春和景丽
    2020-11-27 18:59

    I ended up resizing the bitmap using the following code which seems to have resolved the issue.

    BitmapFactory.Options options = new BitmapFactory.Options();
    options.inSampleSize = 8;
    Bitmap preview_bitmap = BitmapFactory.decodeFile(mPathName, options);
    

提交回复
热议问题