killProcess可以在某些情况下可以使用

killProcess可以在某些情况下可以使用

本文介绍了killProcess可以在某些情况下可以使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的活动注销按钮。在我的情况下killProcess做我想做的事,而不是结束(),但它是用killProcess一个好主意?我已阅读,最好不要使用killProcess但在某些情况下,似乎是有用的。

I have a logout button in my activity. In my case the killProcess do what I want to do instead of the finish(), but is it a good idea to use killProcess? I have read that is better not to use killProcess but in some cases seems to be useful.

推荐答案

调用killProcess立即停止这一进程。有没有办法为你的应用程序,以prevent这样或prepare它。但是,当你调用完成你的应用程序通知,并有机会释放系统资源,保存状态等。使用面漆是推荐和preferred的方式来关闭下来。要使用killProcess会被认为hackish的坏作风。

Calling killProcess stops the process immediately. There is no way for your app to prevent this or prepare for it. However, when you call finish you app is notified and is given a chance to release system resources, save states, etc. Using finish is the recommended and preferred way to shut things down. To use killProcess would be considered hackish and bad style.

如果您有问题,完成()关闭应用程序速度不够快,你应该考虑重载该方法。

If you are having problems with finish() closing the app fast enough you should consider overloading that method.

这篇关于killProcess可以在某些情况下可以使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 12:56