Here are some novice memory management observations that I would like to hear a challenged opinion.
It seems that setting android: backgound = "@ drawable / xyz" in the xml layout causes memory loss in my application. Relevant events are saved when I get an OOM error. This is especially true if I rotate the orientation of the device.
However, if I load the same resource using setBackgoundResource () and then clear the callback and set the original link to null, there is no leak.
i.e. first in onCreate ()
mMainLayout.setBackgroundResource(R.drawable.background_general_android);
and then in onDestroy ()
mMainLayout.getBackground().setCallback(null);
mMainLayout.setBackgroundDrawable(null);
Is this roughly correct, or am I missing something substantial?
perza source
share