views:

159

answers:

2

Hi all, like many others, I want to kill my Android application on "exit" button. Really kill, not just move to background and stop all active code. (I know very well that Android does not like it.)

I found Process.killProcess(Process.myPid()); and System.exit(0) which both work fine (I have no problem with activity stack, the "exit" button is in my base Activity.).

But there is a problem. When I kill my process and I am back in the shell, I press [Home] button. It shows list of applications that are on the background including my application which has been killed.

Is there a way how to do both: 1) kill the process and 2) remove it from the Android application list that is shown after user presses [Home] button ?

Thanks for all replays (with the exception of that stupid "you should not exit applications explicitly on Android" :-) )

Jan

+3  A: 

If you mean list of applications showing on long press on "Home" button, then it is not list of applications on background, but just list of last running applications.

Sergey Glotov
OK. Thank you. It was simple.
Jan Němec
A: 

If you dont want your application to show up in the recently used applications list then you can use the following code in your manifest.

android:excludeFromRecents="true"
Donal Rafferty