I have multiple activity. Each activity shows images in a GridView. Each activity as an standalone application works fine. The problem occurs when i call an activity from another one. An item of GridView(second/third activities) is an imageView :
<ImageView
android:id="@+id/grid_sub_item_image"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:contentDescription="@string/descr_image"
android:scaleType="centerCrop" >
</ImageView>
When I set width, height in dp/px it works well.LIke:
android:layout_width="100dp"
android:layout_height="100dp"
Works fine for me.
But when I set height/width : wrap_content/fill_parent, its getting Out of Memory exception:
null
java.lang.OutOfMemoryError
android.graphics.BitmapFactory.nativeDecodeStream(Native Method)
android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:493)
com.nostra13.universalimageloader.core.ImageDecoder.decode(ImageDecoder.java:83)
com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.decodeWithOOMHandling(LoadAndDisplayImageTask.java:187)
com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.decodeImage(LoadAndDisplayImageTask.java:170)
com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.tryLoadBitmap(LoadAndDisplayImageTask.java:126)
com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.run(LoadAndDisplayImageTask.java:72)
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:442)
java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
java.util.concurrent.FutureTask.run(FutureTask.java:137)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
java.lang.Thread.run(Thread.java:856)
I have instantiated ImageLoader at every Activity. But it does not help.