Wednesday, July 31, 2013

[android-developers] Re: Getting OutOfMemory Error while loading images in fragments. (Only on Android OS version 4.1.2 Jelly Bean)

Different versions handle memory differently, some might just have bugs that affect the way you handle your code.
I'd check that you're not leaking any of the images (watch the memory allocation when switching fragments)

Just load each image once it is needed for display. there are more than a few examples available online (especially for creating Gallery like apps), Also, always a good idea to protect the image loading code and making sure you only load the image at a resolution that is appropriate to the available display it has.

On Thursday, August 1, 2013 7:06:43 AM UTC+3, Matt wrote:
Oh ok, so do I need to use something like lazy list or is there any way that i can handle it in my code. I am using Fragment Activity and have created two fragments and replacing them alternatively for displaying all the images one by one. 

One more thing that i don't understand is why only on 4.1.2?! I tested the application on android 2.3.3, 4.0.3, 4.0.4, 4.1.1, 4.2, also on different devices with lower and higher processors, i.e. samsung galaxy s plus, galaxy s2, sony xperia tipo, samsung galaxy tab 7 and 10.1. On all the devices, it doesn't crash but only on the devices with version 4.1.2.

--
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
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 android-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment