I am implementing an android application in which I am attaching images to issues. These attachments are of two types,
attachment by using camera
attachment of photo from gallery (already existing photo in gallery)
I am getting these Images as follows,
//Camera Request
Intent captureImage = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
captureImage.putExtra(android.provider.MediaStore.EXTRA_OUTPUT, imageFileUri);
startActivityForResult(captureImage, CAMERA_PIC_REQUEST);
// Gallery Pic request
Intent intent = new Intent(Intent.ACTION_PICK,
android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(intent, GALLERY_PIC_REQUEST);
The result of above is URI. And I am saving this uri.getPath() in my database.
Now problem is when I want to show these images I am fetching it with the help of uri I am having. But I am getting an exception after loading first image; java.lang.OutOfMemoryError: bitmap size exceeds VM budget
I read some blogs and I came to know that memory is insufficient for loading it.
Is anybody having working solution on compressing images while showing them in a list And recycle memory used after work is done??
1 Answer