If you click on home button from your application your in the activity which is in foreground onStop() method is called. When from long press on home button or recent button you go back to the activity onRestart() and then onStart() is called.
If you close the app (using the back button) and start the app from the long press on the home button or recent button it will go to onCreate(). If you want to avoid registering and unregistering the user when the user clicks on the home button from activity you should place the code for registering in OnCreate and unregistering in onDestroy. I hope that it helped Sent from my iPad On 28 Mar 2012, at 11:20, jugni <[email protected]> wrote: > hello all, > > I press the home key for move the application to run in background and when i > want to open that application then i pressing home key long time it will > display all running activity.and i click on my application so i need it will > open at last state where it is run in background but it will execute some > code of application which will register the user in main activity.can we said > that it is run from oncreate() or on what state?.or how can we perevent this > code will not execute when the application come from background to > front.Thanks in advance. > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

