I’ve got a program which is loading resources from the resource file (by setting android:src=”@drawable/image” in the layout file.
The image is 800 x 1280 pixels. When the program runs it allocates 16,384,000 bytes on the heap which is 16 BYTES per pixel.
I assumed that it should default to RGB8888 which only uses 4 bytes per pixel. Anyone know how I can change this to use less memory?
Your images could be stored in an inappropiate folder. If you have high resolution images in a low resolution folder, let’s say, the images are 800 x 1280 and you’re storing it in drawable or drawable-hdpi, Android will scale them up to match xhdpi (although they are already in xhdpi, so to say). The scaled image occupies more memory.
Solution, put them in drawable-xhdpi.