简体   繁体   English

Android警报对话框强制关闭

[英]Android Alert Dialog Force Close

Is there any way to build an Alert Dialog with a Button "Force Close" that close the app? 是否有任何方法可以使用关闭应用程序的按钮“强制关闭”来构建警报对话框?

Thanks 谢谢

That depends on you activity life cycle. 这取决于你的活动生命周期。 If you always finish your activities after starting a new one, you can simply create a dialog with one button and on click of the button, you simply call finish() and thats it. 如果您在开始新活动后总是完成您的活动,您只需创建一个带有一个按钮的对话框,然后单击该按钮,您只需调用finish()就可以了。

A general "close the whole application" is not how the life cycle should be used. 一般的“关闭整个应用程序”不是如何使用生命周期。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM