I have a Gallery widget that allows a user to select from a variety of images which I supply with the app. Because of different screen resolutions, I have different size images in different drawable folders. Eg drawable-large has 1280×800 versions of the images, drawable normal has 480×320. This is so the image looks good once selected on all resolutions.
The problem I am having is that the Gallery widget, on large resolutions, ends up using the 1280×800 versions of the images to populate the widget. With around 6 of these images, the VM heap memory becomes too large and the app stops working.
Is there any way to force loading images from a specific drawable folder?
I know I could easily solve the problem by adding extra images to my folders but I don’t want to increase the size of my app too much.
You can create aliases to your resources, see http://developer.android.com/guide/topics/resources/providing-resources.html#AliasResources
You can then put all your gallery image that are used by multiple resolution in one place, so as to not have resource duplicate in your folders.