Ok, thanks for the information. It is really useful. I also kept searching about it and have used Universal Image Loader, however, I tried to implement UIL but I am facing problems doing animation on top of each image, which I was successfully doing with Fragments. I think I will try to implement some image caching method for my fragments and also scale my bitmap down with the use of BitmapFactory options.
One more thing I would like to share is I tried using Bitmap scaling and it worked better. The app was more stable with that but there I faced a problem with recycling bitmap. When I changed Fragment, I was recycling the Bitmap inside onDestroy method. But with this method, I was getting exception saying cannot set recycled Bitmap and the screen would go blank for some of the images. So, I think the only option I can use right now is implementing image caching in my fragments, but I really need to learn as I am still new to Android and haven't implemented these functions before for image processing, apart from using Universal Image Loader. On Wednesday, July 31, 2013 7:16:43 PM UTC+5:30, Matt wrote: > > Hi all, > > I am loading several images on Fragments. I have about 22 images of total > 2.3 MB. I am getting OutOfMemory error every time I test my app on devices > with Jelly Bean 4.1.2. The weird thing is, this happens only when I test it > on devices with Android version 4.1.2. It works fine on any other versions > on any devices. I am posting my error log here. Please let me know what > could be wrong: > > 07-31 14:08:48.688: D/dalvikvm(11970): GC_FOR_ALLOC freed 963K, 42% free > 24641K/41863K, paused 30ms, total 31ms > 07-31 14:08:48.688: I/dalvikvm-heap(11970): Grow heap (frag case) to > 29.015MB for 3932176-byte allocation > 07-31 14:08:48.748: D/dalvikvm(11970): GC_CONCURRENT freed 2170K, 38% free > 26311K/41863K, paused 14ms+5ms, total 60ms > 07-31 14:08:48.803: D/dalvikvm(11970): GC_FOR_ALLOC freed 0K, 38% free > 26311K/41863K, paused 17ms, total 17ms > 07-31 14:08:48.803: I/dalvikvm-heap(11970): Forcing collection of > SoftReferences for 8847376-byte allocation > 07-31 14:08:48.828: D/dalvikvm(11970): GC_BEFORE_OOM freed 0K, 38% free > 26311K/41863K, paused 25ms, total 25ms > 07-31 14:08:48.828: E/dalvikvm-heap(11970): Out of memory on a > 8847376-byte allocation. > 07-31 14:08:48.828: I/dalvikvm(11970): "main" prio=5 tid=1 RUNNABLE > 07-31 14:08:48.828: I/dalvikvm(11970): | group="main" sCount=0 dsCount=0 > obj=0x4119c508 self=0x40f509a0 > 07-31 14:08:48.828: I/dalvikvm(11970): | sysTid=11970 nice=0 sched=0/0 > cgrp=apps handle=1074540336 > 07-31 14:08:48.828: I/dalvikvm(11970): | schedstat=( 14365434265 > 4071559868 25502 ) utm=1314 stm=122 core=1 > 07-31 14:08:48.828: I/dalvikvm(11970): at > android.graphics.BitmapFactory.nativeDecodeAsset(Native Method) > 07-31 14:08:48.828: I/dalvikvm(11970): at > android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:625) > 07-31 14:08:48.828: I/dalvikvm(11970): at > android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:478) > 07-31 14:08:48.828: I/dalvikvm(11970): at > android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:781) > 07-31 14:08:48.833: I/dalvikvm(11970): at > android.content.res.Resources.loadDrawable(Resources.java:1963) > 07-31 14:08:48.833: I/dalvikvm(11970): at > android.content.res.Resources.getDrawable(Resources.java:672) > 07-31 14:08:48.833: I/dalvikvm(11970): at > android.view.View.setBackgroundResource(View.java:14497) > 07-31 14:08:48.833: I/dalvikvm(11970): at > com.example.myexample.pages.CoverPage.onActivityCreated(CoverPage.java:46) > 07-31 14:08:48.833: I/dalvikvm(11970): at > android.support.v4.app.Fragment.performActivityCreated(Fragment.java:1468) > 07-31 14:08:48.833: I/dalvikvm(11970): at > android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:931) > 07-31 14:08:48.833: I/dalvikvm(11970): at > android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1088) > 07-31 14:08:48.833: I/dalvikvm(11970): at > android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682) > 07-31 14:08:48.833: I/dalvikvm(11970): at > android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1444) > 07-31 14:08:48.833: I/dalvikvm(11970): at > android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:429) > 07-31 14:08:48.833: I/dalvikvm(11970): at > android.os.Handler.handleCallback(Handler.java:615) > 07-31 14:08:48.833: I/dalvikvm(11970): at > android.os.Handler.dispatchMessage(Handler.java:92) > 07-31 14:08:48.833: I/dalvikvm(11970): at > android.os.Looper.loop(Looper.java:137) > 07-31 14:08:48.833: I/dalvikvm(11970): at > android.app.ActivityThread.main(ActivityThread.java:4921) > 07-31 14:08:48.833: I/dalvikvm(11970): at > java.lang.reflect.Method.invokeNative(Native Method) > 07-31 14:08:48.833: I/dalvikvm(11970): at > java.lang.reflect.Method.invoke(Method.java:511) > 07-31 14:08:48.833: I/dalvikvm(11970): at > com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1027) > 07-31 14:08:48.833: I/dalvikvm(11970): at > com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794) > 07-31 14:08:48.833: I/dalvikvm(11970): at > dalvik.system.NativeStart.main(Native Method) > 07-31 14:08:48.833: A/libc(11970): Fatal signal 11 (SIGSEGV) at 0x00000000 > (code=1), thread 11970 (ple.storybookex) > 07-31 14:08:58.808: E/run(11970): run-runnable > -- -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.

