Yuchih wrote:
> Hello all:
> I have a activity always runs onCreate() after I come back to previous
> activity.
> I think my emulator needs memory, so it killed my activity.
> But I use eclipse DDMS tool to watch my process, it still there with
> the same process id.
> This really confuses me. Could anyone explain why?

Just because your activity is being destroyed to reclaim memory does not
mean the process is going away. Java uses garbage collection, and the
Dalvik VM apparently has some hooks to allow the VM to return memory to
the OS on occasion. Hence, if Android destroys your activity, and GC
reclaims your activity's memory, that memory can be used by others.

> Here is the link describe activity life cycle, always kill process
> before running onCreate()
> http://developer.android.com/reference/android/app/Activity.html#ActivityLifecycle

You will notice that there are other paths in that diagram that cause
your activity to be destroyed that do not involve terminating the process.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

_Android Programming Tutorials_ Version 1.1 Available!
-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to