OutofMemoryError: bitmap size exceeds VM budget (Android)

后端 未结 9 732
甜味超标
甜味超标 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 19:06

    use these options in decodefile. hope u can elemenate bitmap exceeds vm budget problem..

    BitmapFactory.Options bfOptions=new BitmapFactory.Options(); 
    
    bfOptions.inDither=false;          //Disable Dithering mode
    bfOptions.inPurgeable=true;       //Tell to gc that whether it needs free memory, the Bitmap can be cleared
    bfOptions.inInputShareable=true;  //Which kind of reference will be used to recover the Bitmap data after being clear, when it will be used in the future
    bfOptions.inTempStorage=new byte[32 * 1024]; 
    

提交回复
热议问题