![]() Android reserves the HOME key event to itself so that a developer cannot prevent users from leaving their application. ![]() For example in the destroy method of the root activity (assuming that the app never kills this activity):Īlso Android will not notify an application of the HOME key event, so you cannot close the application when the HOME key is pressed. The best way to do this is put a method like the following in a helper class and then call it whenever the app needs to be killed. You can also kill an application quickly via android.os.Process.killProcess(android.os.Process.myPid()) if you prefer. The call to nFinalizersOnExit(true) ensures that all objects will be finalized and garbage collected when the the application exits. In the last Activity that is exited (usually the main Activity that first came up when the application started) just place a couple of lines in the onDestroy() method. Android has a mechanism in place to close an application safely per its documentation.
0 Comments
Leave a Reply. |