as a many people i have a problem with big images too.
ok,here my code. I found on stackoverflow how to fix this using BitmapFactory.Options. But in my situations i get image not from file. Can anyone tell me how to do this with Bitmap which already created in memory ( i get this picture from camera on phone)
public void getImageAndSend( )
{
Bitmap newbmp ;
newbmp= Bitmap.createBitmap(oBmp.getWidth(), oBmp.getHeight(),oBmp.getConfig());////<----------error here
log("widt oBmp = "+oBmp.getWidth());/// width = 2048
log(" height oBmp = "+oBmp.getHeight());///height 1538
//BitmapFactory.Options options = new BitmapFactory.Options(); // <----- it's possible to do it without `BitmapFactory.decodeFile(pathToFile,options) ??
//options.inTempStorage = new byte[16*1024];
Canvas canvas = new Canvas(newbmp);
//code
System.gc();/// can't right understand but this line fixed this problem on emulator but not on real device
}
please tell me how to fix my problem ? : (
On emulator im not have this error. But on real device i see this error (bitmap size exceeds VM budget)
Regards, Peter.
since you are getting image from camera,get the uri of the image you capture in onActivityResult() method as follows
Hope this helps.This is the very familiar problem when u deal with high quality images taken from phone.check this out too