退出申请是否令人不悦? [英] Is quitting an application frowned upon?

查看:23
本文介绍了退出申请是否令人不悦?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

继续尝试学习 Android,我只是阅读以下:

Moving on in my attempt to learn Android, I just read the following:

问题:用户是否可以选择终止应用程序除非我们放一个菜单选项来杀死它?如果不存在这样的选项,用户如何终止应用程序?

Answer: (Romain Guy): 用户不会,系统会自动处理.这就是活动生命周期(尤其是 onPause/onStop/onDestroy)的用途.无论您做什么,都不要放置退出"或退出"应用程序按钮.对于 Android 的应用程序模型,它是无用的.这也与核心应用程序的工作方式相反.

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.

嘿嘿,我在 Android 世界中每走一步都会遇到一些问题 =(

Hehe, for every step I take in the Android world I run into some sort of problem =(

显然,您无法退出 Android 中的应用程序(但 Android 系统可以在任何时候完全摧毁您的应用程序).那是怎么回事?我开始认为编写一个功能为普通应用程序"的应用程序是不可能的——用户可以在他/她决定退出时退出应用程序.这不是应该依赖操作系统来做的事情.

Apparently, you cannot quit an application in Android (but the Android system can very well totally destroy your app whenever it feels like it). What's up with that? I am starting to think that it's impossible to write an app that functions as a "normal app" - that the user can quit the app when he/she decides to do so. That is not something that should be relied upon the OS to do.

我尝试创建的应用程序不是适用于 Android Market 的应用程序.它不是一般大众广泛使用"的应用程序,它是一个将在非常狭窄的业务领域中使用的业务应用程序.

The application I am trying to create is not an application for the Android Market. It is not an application for "wide use" by the general public, it is a business app that is going to be used in a very narrow business field.

实际上,我非常期待为 Android 平台进行开发,因为它解决了 Windows Mobile 和 .NET 中存在的许多问题.然而,上周对我来说有点令人失望......我希望我不必放弃Android,但现在看起来不太好=(

I was actually really looking forward to developing for the Android platform, since it addresses a lot of issues that exist in Windows Mobile and .NET. However, the last week has been somewhat of a turnoff for me... I hope I don't have to abandon Android, but it doesn't look very good right now =(

有没有办法让我真的退出应用程序?

Is there a way for me to really quit the application?

推荐答案

这最终会解决您的问题,但我首先想解决您在对当时已经给出的各种答案的各种评论中提出的一些问题这篇文章的.我无意改变你的想法——相反,这些是为将来阅读这篇文章的其他人准备的.

This will eventually get to your question, but I first want to address a number of issues you raise in your various comments to the various answers already given at the time of this writing. I have no intention of changing your mind -- rather, these are here for others who come to read this post in the future.

重点是我不能允许Android 确定我的应用程序何时将被终止.那一定是用户的选择.

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.

数百万人对环境根据需要关闭应用程序的模型非常满意.这些用户根本不考虑终止"Android 应用程序,就像他们想的那样终止"网页或终止"恒温器.

Millions of people are perfectly happy with the model where the environment closes up the application as needed. Those users simply don't think about "terminating" the Android app, any more than they think about "terminating" a Web page or "terminating" a thermostat.

iPhone 用户的情况大致相同,因为按下 iPhone 按钮不一定感觉"在按下 iPhone 按钮.就像应用程序被终止一样,因为许多 iPhone 应用程序从用户离开的地方开始,即使应用程序真的被关闭了(因为 iPhone 一次只允许一个第三方应用程序,目前).

iPhone users are much the same way, in that pressing the iPhone button does not necessarily "feel" like the app was terminated since many iPhone apps pick up where the user left off, even if the app really was shut down (since iPhone only allows one third-party app at a time, at present).

正如我上面所说,有很多我的应用程序中发生的事情(数据是推送到设备,列出任务总是应该在那里,等等).

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)更新您的数据以获得最大的可靠性.

I don't know what "lists with tasks that always should be there" means, but the "data being PUSHed to the device" is a pleasant fiction and should not be done by activity in any case. Use a scheduled task (via AlarmManager) to update your data for maximum reliability.

我们的用户登录后无法进行每次他们接到电话Android 决定终止该应用程序.

Our users log in and can't be doing that every time they get a phone call and Android decides to kill the app.

有许多 iPhone 和 Android 应用程序可以解决这个问题.通常是因为他们持有登录凭据,而不是每次都强制用户手动登录.

There are many iPhone and Android applications that deal with this. Usually, it is because they hold onto login credentials, rather than forcing users to log in every time manually.

例如,我们要检查更新退出应用程序时

For example, we want to check updates when exiting the application

这在任何操作系统上都是错误的.据您所知,您的应用程序被退出"的原因是是因为操作系统正在关闭,然后您的更新过程将在中途失败.一般来说,这不是一件好事.要么在启动时检查更新,要么完全异步地检查更新(例如,通过计划任务),从不退出.

That is a mistake on any operating system. For all you know, the reason your application is being "exited" is because the OS is shutting down, and then your update process will fail mid-stream. Generally, that's not a good thing. Either check updates on start or check updates totally asynchronously (e.g., via a scheduled task), never on exit.

一些评论建议击中后退按钮不会杀死应用程序全部(请参阅我上面问题中的链接).

Some comments suggest that hitting the back button does not kill the app at all (see link in my question above).

按返回"按钮不会终止应用".当用户按下返回"按钮时,它会完成屏幕上的活动.

Pressing the BACK button does not "kill the app". It finishes the activity that was on-screen when the user pressed the BACK button.

它应该只在用户想要终止它 - 从不任何其他方式.如果你不会写行为与 Android 中类似的应用程序,那我觉得安卓不能用了用于编写真正的应用程序 =(

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 =(

Web 应用程序也不能.或者 WebOS,如果我正确理解他们的模型(还没有机会玩).在所有这些中,用户不会终止"任何事——他们就离开.iPhone 有点不同,因为它目前一次只允许运行一个东西(有一些例外),因此离开的行为意味着应用程序的立即终止.

Then neither can Web applications. Or WebOS, if I understand their model correctly (haven't had a chance to play with one yet). In all of those, users don't "terminate" anything -- they just leave. iPhone is a bit different, in that it only presently allows one thing to run at a time (with a few exceptions), and so the act of leaving implies a fairly immediate termination of the app.

有什么办法可以让我真正戒烟应用程序?

Is there a way for me to really quit the application?

正如其他人告诉您的那样,用户(通过 BACK)或您的代码(通过 finish())可以关闭您当前正在运行的活动.对于正确编写的应用程序,用户通常不需要其他任何东西,就像他们需要退出"程序一样.使用 Web 应用程序的选项.

As everybody else told you, users (via BACK) or your code (via finish()) can close up your currently-running activity. Users generally don't need anything else, for properly-written applications, any more than they need a "quit" option for using Web applications.

根据定义,没有两个应用程序环境是相同的.这意味着您可以在新环境出现和其他环境被掩埋时看到环境中的趋势.

No two application environments are the same, by definition. This means that you can see trends in environments as new ones arise and others get buried.

例如,越来越多的运动试图消除文件"的概念.大多数 Web 应用程序不会强迫用户考虑文件.iPhone 应用程序通常不会强迫用户考虑文件.Android 应用程序通常不会强迫用户考虑文件.等等.

For example, there is a growing movement to try to eliminate the notion of the "file". Most Web applications don't force users to think of files. iPhone apps typically don't force users to think of files. Android apps generally don't force users to think of files. And so on.

同样,越来越多的运动试图消除终止"的概念.一个应用程序.大多数 Web 应用程序不会强制用户注销,而是在用户一段时间不活动后隐式注销.Android 也是如此,iPhone(可能还有 WebOS)也是如此.

Similarly, there is a growing movement to try to eliminate the notion of "terminating" an app. Most Web applications don't force the user to log out, but rather implicitly log the user out after a period of inactivity. Same thing with Android, and to a lesser extent, iPhone (and possibly WebOS).

这需要更加重视应用程序设计,专注于业务目标,而不是坚持与之前的应用程序环境相关的实施模型.没有时间或不愿意这样做的开发人员会对打破他们现有思维模型的新环境感到沮丧.这不是任何一种环境的错,更像是一座山的错,因为风暴在它周围流动而不是通过它.

This requires more emphasis on application design, focusing on business goals, and not sticking with an implementation model tied to a previous application environment. Developers who lack the time or inclination to do this will get frustrated with newer environments that break their existing mental model. This is not the fault of either environment, any more than it is the fault of a mountain for storms flowing around it rather than through it.

例如,一些开发环境,如 Hypercard 和 Smalltalk,有应用程序和开发工具混合在一个设置中.除了应用程序的语言扩展(例如,VBAExcel、AutoCAD 中的 Lisp).因此,如果开发人员提出了假设应用本身存在开发工具的心智模型,他们要么不得不改变他们的模型,要么将自己限制在他们的模型适用的环境中.

For example, some development environments, like Hypercard and Smalltalk, had the application and the development tools co-mingled in one setup. This concept did not catch on much, outside of language extensions to apps (e.g., VBA in Excel, Lisp in AutoCAD). Developers who came up with mental models that presumed the existence of development tools in the app itself, therefore, either had to change their model or limit themselves to environments where their model would hold true.

所以,当你写:

连同其他杂乱的东西我发现,我认为发展我们的 Android 应用程序不会发生.

Along with other messy things I discovered, I think that developing our app for Android is not going to happen.

这似乎是最好的,对你来说,现在.同样,我建议您不要尝试将您的应用程序移植到 Web,因为您在 Android 上报告的一些相同问题也会在 Web 应用程序中找到(例如,没有终止").或者,相反,如果有一天您确实将您的应用移植到 Web,您可能会发现 Web 应用程序的流程可能更适合 Android,届时您可以重新访问 Android 移植.

That would appear to be for the best, for you, for right now. Similarly, I would counsel you against attempting to port your application to the Web, since some of the same problems you have reported with Android you will find in Web applications as well (e.g., no "termination"). Or, conversely, someday if you do port your app to the Web, you may find that the Web application's flow may be a better match for Android, and you can revisit an Android port at that time.

这篇关于退出申请是否令人不悦?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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