killprocess:
In Android we can write if we want the process of the program to end:
Android.os.Process.killProcess (Android.os.Process.myPid ());
This allows you to end the process of the current program from the operating system.
Note: All activity in Android is in the main process and can be set to start a different process in androidmanifest.xml, and the service is not a separate process or a thread.
When you kill the process of the current program, that is, all threads of the entire program will end, the service will stop, and the entire program exits completely.
System.exit:
When we write Java programs we must have used System.exit (0), which means to quit the JVM (Java Virtual Machine), in the same way as Android, We can imagine that the VMs are out of course the program that executes System.exit will exit completely and the memory is freed.
Note: In the Android phone to see the currently running process can also see the "Background cache process", you will find that many of the exiting program is also in the background cache process, if you do not let the program in the background cache then can use System.exit (0); To quit the program, You can clear the background cache of this process.
System.exit (0), the difference between system.exit (1):
Parameters 0 and 1 represent the state of exit, 0 indicates a normal exit, and 1 indicates an abnormal exit (as long as a non-0 is an exception exit), even if does not pass zero execution can also exit, this parameter only notifies the operating system whether the program is normal exit.
Android Development Two exit program mode (KILLPROCESS,SYSTEM.EXIT)