They don't have the same instance state.  You can use "adb shell dumpsys
activity" to see the system's activity stack; each of those entries is an
"instance" of an activity as far as the system is concerned.

Killing a process while its UI is in the background is a normal situation on
the system -- it is what happens when memory is low.  It is expected, and
doesn't impact the instance that the system has on the stack.  (It will just
have to ask the app to re-create it the next time the user visits it.)

Killing a process while it is in the foreground is not normal.  In that case
the system didn't have time to ask it to save its instance state, so it can
not re-start the activity in its last state, so it throws that instance
away.

On Mon, Nov 8, 2010 at 9:14 AM, Mark Murphy <mmur...@commonsware.com> wrote:

> On Mon, Nov 8, 2010 at 11:38 AM, Mathias Lin <m...@mathiaslin.com> wrote:
> > thanks for your reply. Yes, it's probably managed by the system, yet
> > I'm still wondering:
> >
> > Below you can see that the browser activity runs in different
> > processes (#2307, #5536) before and after I killed/restarted it, and
> > yet it's displaying / restoring the same UI input values entered by
> > the user, regardless of being in an entire new process.
>
> That make sense.
>
> > So, are the two activities in these two processes actually the same
> > instance?
>
> That's not possible. Each process has its own VM. However, they might
> have the same *instance state* (i.e., Bundle).
>
> I have no real idea what you're trying to accomplish here -- what you
> originally posted sounds scary. However, the answer for dealing with
> all this in-flight instance state stuff is to reboot the phone. Since
> you're running a rooted phone, I would think there's a way to reboot
> it.
>
> --
> Mark Murphy (a Commons Guy)
> http://commonsware.com | http://github.com/commonsguy
> http://commonsware.com/blog | http://twitter.com/commonsguy
>
> Warescription: Three Android Books, Plus Updates, One Low Price!
>
> --
> 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<android-developers%2bunsubscr...@googlegroups.com>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>



-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

-- 
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