本文翻译自:How to quit android application programmatically
I Found some codes for quit an Android application programatically. 我找到了一些以编程方式退出Android应用程序的代码。 By calling any one of the following code in onDestroy() will it quit application entirely? 通过在onDestroy()中调用以下任何一个代码,它会完全退出应用程序吗?
-
System.runFinalizersOnExit(true)
(OR) (要么) -
android.os.Process.killProcess(android.os.Process.myPid());
I dont want to run my application in background after clicking quit button. 我不想在单击退出按钮后在后台运行我的应用程序。 Pls suggest me can i use any one of these code to quit my app? 请问我可以使用这些代码中的任何一个来退出我的应用程序吗? If so which code can i use? 如果可以,我可以使用哪些代码? Is it good way to quit the app in Android? 这是退出Android应用程序的好方法吗?
#1楼
参考:https://stackoom.com/question/qyM0/如何以编程方式退出android应用程序
#2楼
I think that application should be kill in some case. 我认为在某些情况下应用程序应该是kill。 For example, there is an app can be used only after login. 例如,有一个应用程序只能在登录后使用。 The login activity has two buttons, 'login' and 'cancel'. 登录活