Thankyou, I needed finishTaskonLaunch as that is more suitable than clearTaskOnLaunch for my case as I need to close the activity itself which I am opening in a separate task.
On Feb 20, 10:56 am, intbt <in...@tacberry.com> wrote: > it may be as simple as adding > > android:clearTaskOnLaunch="true" > > in your Manifest under the main activity tag to re-initialize after > returning to Home screen. > > intbt > > On Feb 20, 4:54 am, Mark Murphy <mmur...@commonsware.com> wrote: > > > Achanta wrote: > > > But since I started trying to log everything to see the activity life > > > cycle, what I observed is that onStop method is not actually being > > > called when I click on home button. > > > :: blink, blink :: > > > > Its being called as soon as i open > > > my app again, which is not how I wanted it to do. The locationUpdates > > > should stop the moment the user hits home button. > > > I just tried it on an app I'm working on (Android 2.1), and onStop() was > > called at the point I pressed the HOME button. > > > Are you doing anything unusual in your manifest vis a via > > android:launchMode or similar settings? > > > > The other thing is that I expected my stack to be as it is and as soon > > > as I open my app after hitting on home button, the activity which I > > > was previously in will be opened. But it restarted the app itself. > > > > This is what I observed in my app. > > > Say I have a main activity A and another Activity B. > > > I come to Activity B from Activity A. > > > Then I click on home button. > > > It closes the app but does not yet call onStop on B. > > > Now I open my app and it now calls onStop on Activity B. > > > It starts Activity A again. > > > Now only when I click on button for activity B, it calls onRestart > > > method on Activity B. > > > I just tried it with this same scenario (Activity A -> Activity B -> > > HOME), and again, onStop() was called at the point I pressed HOME. > > > > So am I doing something wrong or is it supposed to work in that way or > > > is it a bug? > > > Well, there appears to be something afoot either with your app or with > > your environment. onStop(), at least as of Android 2.1, seems to behave > > as documented for fairly ordinary stuff. Mind you that my test code does > > not mess with android:launchMode or flags on activity starting or > > whatever, so if you are, that's something to experiment with. > > > -- > > Mark Murphy (a Commons > > Guy)http://commonsware.com|http://twitter.com/commonsguy > > > Android Development Wiki:http://wiki.andmob.org > > -- 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