Android setImageURI out of memory error
Posted
by Improver
on Stack Overflow
See other posts from Stack Overflow
or by Improver
Published on 2010-06-11T07:33:43Z
Indexed on
2010/06/11
7:42 UTC
Read the original article
Hit count: 576
I have a very small activity that must show an image.
If picture is not very small (for example 1.12 Mb 2560x1920) it produces out of memory on change screen orientation. I tried getDrawable.setCallback(null) but no luck.
Where am I wrong?
public class Fullscreen extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
System.gc();
setContentView(R.layout.fullscreen);
ImageView imageView = (ImageView) findViewById(R.id.full_screen_image);
long imageId = 2;
imageView.setImageURI(Uri.withAppendedPath(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, "" + imageId));
}
}
© Stack Overflow or respective owner