I'm creating an android app and have run into OOM problems due to Bitmap images. I certainly need to make the images smaller in terms of memory however I would like to practice correct memory consumption and load them correctly.
Currently my layouts contain the references to the images within the res/drawable-hdpi folder as their backgrounds. I looked at this other stack overflow question: outOfMemoryError with background drawables where the person asking the question had the same problem as I did. I see that the answer states that I should reference the Bitmaps in java and then recycle onPause and set them back up during onResume. Now does this mean that I should not set the backgrounds in xml and then do so within java oncreate and then recycle and set them back up during onResume? Also, I was looking into WeakReferencing but have found myself getting confused by it... Could anyone give me a good explanation of WeakReferencing?
I appreciate all answers,
Cheers,
Jake