OOM comes up when setting image to imageView by the uri
问题 I have saved an image to a file and when I want to read the file and set the image to the imageView , I face with OOM exception. This is my code : File tempImageFile = new File(Environment.getExternalStorageDirectory().getPath() + "/AHOORATempImage"); FileOutputStream fileOutputStream = new FileOutputStream(tempImageFile); fileOutputStream.write(data); fileOutputStream.flush(); fileOutputStream.close(); imageView.setImageURI(Uri.fromFile(tempImageFile)); and This is part of error in logCat :