0

I noticed something odd. If I open an image (1.6mb) from Drawable Resource, the app crashes with the OutOfMemory error, however, if I open the same image which is saved on SD Card, the app does not crash.

What is the effect of the two?

Solution:

Place images in /drawable-nodpi folder and not /drawable

Cause:

pictures in "/drawable" generic folder are considered by the system like "/drawable/mdpi". So the images are resized when used by the system, causing the OutOfMemory error.

KickAss
  • 4,210
  • 8
  • 33
  • 41

1 Answers1

1

check this out :

I had all the pictures in "/drawable" generic folder that is considered by the system like "/drawable/mdpi", so when I were running in devices with hdpi or more the images were resized, and became too big which cause OutOfMemoryException!

from: Android setBackgroundResource cause out of memory excepiton

you think this might be your case?

Community
  • 1
  • 1
gaurav5430
  • 12,934
  • 6
  • 54
  • 111