I have more than 8 activities in my android application all the screens has lot of imageView which will be rendered with bitmap images
when we open all the screens (activities) it will work for couple of times correctly then it will through out of memory Error and the application crashes out
Here is my code how display Images, kindly suggest how to avoid this/ manage this out of memory issue
XML:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@drawable/img_background">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitCenter"
android:adjustViewBounds="true"
android:id="@+id/artifactImage"
android:onClick="displayFullScreenImage"/>
</LinearLayout>
Activity:
ImageView artifact_Image = (ImageView) gridView.findViewById(R.id.artifactImage);
artifact_Image.setImageBitmap(artifactImages[position]);
artifact_Image.setDrawingCacheEnabled(false);