继续尝试学习 Android,我只是 read the following :
Question: Does the user have a choice to kill the application unless we put a menu option in to kill it? If no such option exists, how does the user terminate the application?
Answer: (Romain Guy): The user doesn't, the system handles this automatically. That's what the activity lifecycle (especially onPause/onStop/onDestroy) is for. No matter what you do, do not put a "quit" or "exit" application button. It is useless with Android's application model. This is also contrary to how core applications work.
这最终会解决您的问题,但我首先想解决您在对撰写本文时已经给出的各种答案的各种评论中提出的一些问题。我无意改变你的想法——相反,这些是为将来阅读这篇文章的其他人准备的。
The point is that I cannot allow for Android to determine when my app is going to be terminated. that must be the choice of the user.
As I said above, there is a lot of things going on in my app (data being PUSHed to the device, lists with tasks that always should be there, etc.).
AlarmManager
)更新您的数据以获得最大的可靠性。Our users log in and can't be doing that every time they get a phone call and Android decides to kill the app.
For example, we want to check updates when exiting the application
Some comments suggest that hitting the back button does not kill the app at all (see link in my question above).
It should only terminate when the users want to terminate it - never ever any other way. If you can't write apps that behave like that in Android, then I think that Android can't be used for writing real apps =(
Is there a way for me to really quit the application?
finish()
)可以关闭您当前正在运行的 Activity 。对于正确编写的应用程序,用户通常不需要其他任何东西,就像他们需要“退出”选项来使用 Web 应用程序一样。Along with other messy things I discovered, I think that developing our app for Android is not going to happen.
关于android - 退出申请是否令人不悦?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2033914/
欢迎光临 OStack程序员社区-中国程序员成长平台 (http://ostack.cn/) | Powered by Discuz! X3.4 |