tags:

views:

64

answers:

3

Hi , I want to check whether the process is still alive or not through programmatically ,Can i do that i am trying to do it by process name in onCreate method but the issue is that the onCreate method is called always .When i check that in onCreate method i always get the process name and i can not kill the current app and switch to previous one. Can anybody help me . Thanks in advance.

A: 

I'm not sure I understand why you need this. It sounds more like you are wanting to save your state between application changes (your app going to the background).

On the Android, there are no two programs running at the same time, basically (there are services, but those are different). Once your user goes back to the main screen, if they "launch" your application again, it will go to the first activity defined, unless you override some functions to restore the previous state of the application.

Crowe T. Robot
yes it is saving state is there any other way ..
Sam97305421562
A: 

There is no "the previous one" to go back to.

Unless you have seriously messed around with your manifest, there will be only one copy of your application (in one process) at a time.

CommonsWare
A: 

Refer to this article in the Android documentation, specifically the Processes and Threads section: Application Fundamentals

When the first of an application's components needs to be run, Android starts a Linux process for it with a single thread of execution. By default, all components of the application run in that process and thread.

Bryan Bedard