I am trying to display images taken by the camera and display them in an application. When I take images with a low resolution (say, 100 kB), I have no problems switching to a raster display, cons, when I take them with a high resolution (1.5 MB), the application crashes with the exception
Error java.lang.OutOfMemoryError.
this happens on my smartphone (Samsung Galaxy SII, SIII Galaxy) on all shelves. At the moment, I decided manually, reducing the quality and size of the photos, but given the evolution of cameras with increasing resolution, this problem is likely to occur more often. Is there a permanent solution to increase the amount of memory allocated for my Android application without manually interfering with the device and the code?
Images are saved in bitmap format
//image creation Uri domuri1 ContentValues cv = new ContentValues(); cv.remove("101"); domuri1 = getContentResolver().insert(Media.EXTERNAL_CONTENT _URI, cv); File domthumb1 = new File(domuri1.toString(), fileName1); //increment photo apparate Intent intent = new Intent("android.media.action.IMAGE_CAPTURE"); intent.putExtra(MediaStore.EXTRA_OUTPUT, domuri1); startActivityForResult(intent, 100); //images save ContentResolver cr = getContentResolver(); bitmap1 = MediaStore.Images.Media.getBitmap(cr, domuri1 ); imageView.setImageBitmap(bitmap1);
vetic
source share