My application consist (for example) of 3 activity: Activity1, Activity2, Activity3. Every activity has a unique background image on all its main layout declared in an XML File. From Activity1 user goes to Activity2 and next to Activity3 so first 2 get pushed into the stack. The problem is that first 2 activities occupy too much memory, and in Activity3 I have OOM exception sometimes. I have found this answer about reason of this behavior - https://stackoverflow.com/a/4836241/1159507 Before this, I believed that when activity goes to stack it releases all memory. I believe that the same behavior with fragments stack. So my question is - how to relese memory when activity or fragment goes to stack and keep responsible UI on back press?
Activity's resources (which are not released in onPause, onStop, ...) do not get released when the Activity goes to the background.