http://developer.android.com/reference/android/app/Activity.html

The Activity Lifecycle could have implementation and or design bug:
One case is to initialize a big image in onCreate(), try to reuse the
image during the whole lifecycle, and then recycle the image in
onDestroy().
Test showed that onCreate() is called every time one navigate away
from the activity and back again, but onDestroy() is not called at
all. This behavour causes memory leaking for the big image (size
960*1920). After 6+ times away and back to activity, the system runs
out of memory and has to kill the process.

One workaround is to initialize the big image in onResume() and
recycle in onPause(), but that's not so good reuse.

Could it be better to change the process (as shown in the diagram) a
little bit such as:
Call onDestroy() first when a process is killed?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to