You cannot use System.exit(0)
. Use finish()
instead. finish
will finish
out the action from the activity stack and destroy it. The previous action in the back stack is focused.
Check out this link and comments by Dianne Hackborn
https://groups.google.com/forum/#!topic/android-developers/Zhd1fRfHAAQ
Check out this link and comments by Romain Guy
https://groups.google.com/forum/#!topic/android-developers/G_D3pKnGLt0
Quote from commentary on Boston Streets
https://groups.google.com/forum/#!topic/android-developers/Y96KnN_6RqM
You should not call System.exit (). This can ruin Android’s workflow and lead to an uncomfortable user experience (for example, when you kill a process, the previous activity from which you highlight your activity may also disappear. Android may try to restart the process again and recreate that the parent accidentally killed -activity. but still).
public static void exit (int code) Added in API level 1 Causes the VM to stop running and the program to exit. If runFinalizersOnExit(boolean) has been previously invoked with a true argument, then all objects will be properly garbage-collected and finalized first. Parameters code the return code.
Rejected the application that was abandoned?
If you are looking for a navigation bar, use the action bar and navigation bar.
source share