Back closes whatever is on the front; home brings the home screen to the
front.  Everything else falls out from that.

On Tue, Dec 16, 2008 at 12:47 AM, jarkman <jark...@gmail.com> wrote:

>
> Justin - thanks for the explanation.
>
> I'm not making any allegation of impropriety on the part of the
> system, just trying to understand what the orthodox behaviour ought to
> be for a 'vanilla' app.
>
> I had completely missed the distinction between leaving via 'back' and
> leaving via 'home', which may account for some of my confusion. I'm
> not sure our users will get that distinction either, but fortunately
> our state is pretty simple so they can't get too bemused.
>
> So, just to check, is the plan that leaving via 'home' seems to the
> user like sending the app to the background, to be restored later,
> whereas leaving via 'back' is closing the app, so it next starts in a
> virgin state ?
>
>
> Richard
>
>
> On Dec 16, 12:18 am, "Justin (Google Employee)" <j...@google.com>
> wrote:
> > Richard,
> >
> > If you save something into the bundle and hit 'home' (button with a
> > house on it), the system will always return a non-null Bundle to you.
> > If you don't save anything to the Bundle, I'm not sure what the system
> > will do.
> >
> > If you hit the 'back' button (button with the arrow), the system will
> > not call onSaveInstanceState and therefore give a null Bundle to
> > onCreate.
> >
> > The other thing that comes to mind is that if you're trying to tweak
> > launch modes, the system may be launching a new instance of your
> > Activity, which it would launch with a null Bundle. If this is the
> > case, hitting the 'back' button should eventually reveal another
> > instance of your same Activity.
> >
> > Its also worth noting that onPause is *not* always followed by onCreate
> > (), it may be followed by onResume or onStop. onStop may then be
> > followed by onRestart, followed by onStart.
> >
> > If the system is improperly discarding state, this would be the first
> > time I've seen it, but its not impossible.
> >
> > Cheers,
> > Justin
> > Android Team @ Google
> >
> > On Dec 15, 9:32 am, jarkman <jark...@gmail.com> wrote:
> >
> > > I'm a bit confused by the saved instance state mechanism.
> >
> > > If I breakpoint in onCreate, run the app, hit the Home button, then
> > > relaunch the app, I typically see a null Bundle passed in to
> > > onCreate.
> >
> > > But, if I (for example) rotate the emulator, I see a non-null Bundle
> > > in onCreate, and the app has the right state after the rotation.
> >
> > > What causes the null in the first example ? It looks as though the
> > > system has thrown away the saved instance state on our behalf.
> >
> > > Thanks,
> >
> > > Richard
> >
> >
> >
>


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