如何以编程方式退出android应用 [英] How to quit android application programmatically
本文介绍了如何以编程方式退出android应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我发现了一些codeS的退出Android应用程序编程。通过调用以下code中的onDestroy()的任何一个将它退出应用程序完全?
-
System.runFinalizersOnExit(真)
(OR) -
android.os.Process.killProcess(android.os.Process.myPid());
我不想点击退出按钮之后,运行我在后台的应用程序。 请给我建议我可以利用这些code退出我的应用程序的任何一个?如果是的话这code我可以使用?是否退出在Android的应用程序的好办法?
解决方案
getActivity()完成();
System.exit(0);
这是退出你的应用程序的最佳途径。!!!
对我来说最好的解决方案。
I Found some codes for quit an Android application programatically. By calling any one of the following code in onDestroy() will it quit application entirely?
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?
解决方案
getActivity().finish();
System.exit(0);
this is the best way to exit your app.!!!
The best solution for me.
这篇关于如何以编程方式退出android应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文