如何完全关闭应用程序 [英] How to close the application completely

查看:103
本文介绍了如何完全关闭应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





在我的Android应用程序中,我有5个活动(页面)。注销后,如果用户预先硬件返回按钮,它将询问你想关闭这个应用程序吗?。如果用户单击是按钮应用程序应关闭(退出)。我使用以下代码



Hi,

In my android application i have 5 activities (pages). After logout and if user pres hardware back button it will ask "Do you want to close this apps?". If user clicks Yes button application should close (quit). I am using following code

System.exit(0);





还,





also,

android.os.Process.killProcess(android.os.Process.myPid());





但它将关闭当前活动并打开以前的活动。如何在android中关闭/退出完整的应用程序。



谢谢...



But it will close the current activity and open the previous activity. How to close/quit complete application in android.

thanks...

推荐答案

阅读: 退出应用程序 - 是不是很不满意? [ ^ ]


这篇关于如何完全关闭应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆