views:

59

answers:

1

hi all,

i am working on my App. in between i pressed the Home button on the device. my app will go to the background tasks. After that i long press the home button it will show my app as a persistent state. i.e where and what i had done in my app. But i click my app in the directory window it restarts my app. i want to do if my app is in the background tasks it will wake up else it will start. how to achieve that? Any Idea?

+1  A: 

When you do that Android will call:

  • onRestart()
  • onStart()
  • onResume()

You can override that methods in order to do what you need. I wouldn't recommend it, though.

Remember that if the device needs memory, it will kill your process and when you open your app again Android will call the onCreate() method of your Activity.

Check the Activity's lifecycle.

Macarse
Thanks a lot.is there any sample code?
Praveen Chandrasekaran
not that I know, sorry :(
Macarse