Hi, there is an issue in 2.1 with the new launcher that causes the
onStop()/onDestroy() to be delayed longer than typical when going back to
home.  Note these are not delayed -forever-, but just until later in the
future (when the next activity switch happens).  These methods are defined
to happen at "some time in the future" so technically it is not really
broken, but this is certainly not the desired behavior here.  This will be
fixed in the next release.

Fwiw, this happened because the new launcher has a special surface view on
top of itself to display the 3d all apps, and this caused the window manager
to be confused and not realize that the app behind it had been hidden so it
could then be stopped/destroyed.

On Wed, Mar 10, 2010 at 6:33 PM, Achanta <krishna.acha...@gmail.com> wrote:

> I too have the same issue and Mark, we discussed it earlier in another
> thread. I was trying to use the onStop and onDestroy to stop Location
> updates and other background threads that I start from onCreate
> method.
>
> Here is what I observed.
>
> Here is what I have seen. I am using Nexus one [2.1].
> Pressing on Home button or the Back button from my main activity does
> not call the onStop method or onDestroy method in this case
> Activities A, B.
> Activity A has a Button which starts activity B.
>
> Now when the activity A is started normally and it does not start
> another thread then the Back button from Activity A is called onStop
> and onDestroy.
> But if the Activity B is started from Activity A or if there is
> another thread that has been started from Activity A and if we come
> back to Activity A from Activity B and then press on the Back button,
> then onStop and onDestroy are not immediately called. But they are
> called after some other activity/application are opened.
> I even observed that they are not always immediately called after
> opening the same activity A. Sometimes they are called after activity
> A starts Activity B.
>
> 1. start A
>  Press Back.
>  onStop and onDwstroy called.
>
> 2. start A.
>   Start another thread or activity from A and come back to A.
>   Click on Back Button From A.
>   onStop and onDestroy are not called.
>   Start another application or the same application.
>   onStop and onDestroy are sometimes[not always immediately] called.
>   start opening more activities.
>   onStop and onDestroy will be called at some point.
>
> 3. Start Activity A.
>   Click on Home button.
>   onStop is never called. [or atleast on two nexus one phones that I
> tested atleast a few times].
>  it will be called at a later point when another application or the
> same application is opened. And just like onStop, this is not in any
> predicted manner but is called at some point.
>
>
> On Mar 10, 10:07 am, Alex <acni...@gmail.com> wrote:
> > I'm having a similar lifecycle issue on the Nexus One.
> >
> > Start the app ->OnCreate
> > Hitback-> no OnDestroy is called
> > Run app again ->OnCreate, followed by OnDestroy
> >
> > The wierd thing is that it doesn't actually kill our application, so
> > it is left in a broken state since we are tearing things down in
> > OnDestroy.
> >
> > -Alex
> >
> > On Mar 7, 11:27 am, skyhigh <skyhigh1...@gmail.com> wrote:
> >
> > > Very few of my activities used onStart and onStop until recently when
> > > I instrumented my application with Flurry Analytics.  If you follow
> > > the Flurry instrumentation instructions then you add calls to notify
> > > Flurry about your application activity in the onStart and onStop
> > > methods for everyoneof your activities.  I am not sure what impact
> > > it will have on the Flurry statistics gathering if these routines
> > > don't get called.
> >
> > > I have had users reporting problems with my application on 2.1 phones
> > > which may be related to the service life cycle not behaving properly
> > > on these phones.  I don't currently have a 2.1 phone to test this on
> > > (I am waiting to get my device seeding phone).  I built an
> > > instrumented beta build that will log the service life cycle
> > > information for me, and am waiting for a customer to run the
> > > instrumented beta build on their 2.1 phone and send mebackthe
> > > logcat, so I can see if there is a similar issue with services.
> >
> >
>
> --
> 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