退出应用程序 - 这是令人难以接受的?这是、应用程序

2023-09-11 10:16:57 作者:陪你一辈子

移动在我尝试学习Android的,我只是read以下:

Moving on in my attempt to learn Android, I just 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?

答:(罗曼盖伊):用户没有,系统将自动处理这一点。这就是活动的生命周期(尤其是在onPause /的onStop /的onDestroy)可以。不管你做什么,不要把跳槽或退出应用程序按钮。这是没有用的与Android的应用模型。这也违背了怎样的核心应用程序的工作。

呵呵,因为每一步我走在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.

数以百万计的人都非常高兴在这里需要环境关闭了该应用程序的模型。这些用户根本不会去想终止的Andr​​oid应用程序,任何超过他们想到的是终止网页或终止恒温器。

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用户都是大致相同的方式,在pressing iPhone的按钮并不一定是感觉之类的应用程序被终止,因为许多iPhone应用拿起用户离开时,即使该应用程序真的是关闭(因为iPhone只允许一次一个第三方的应用程序,在present)。

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).

正如我前面所说,有很多的   事情在我的应用程序正在进行(数据被   推送到设备,交任务列表   总是应该在那里等)。

如何在手机上安装linux

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 an activity in any case. Use a scheduled task (via AlarmManager) to update your data for maximum reliability.

我们的用户登录,不能做   即每次他们得到一个phonecall   和Android决定杀应用程序。

Our users log in and cant be doing that everytime they get a phonecall 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 logon 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 BACK按钮不杀应用程序。它完成,这是在屏幕上,当用户pressed BACK按钮活动。

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的,   那么我认为Android的斜面使用   编写实际的应用程序=(

It should only terminate when the Users wants to terminate it - never ever any other way. If you cant write apps that behave like that in Android, then I think that android cant be used for writing real apps =(

那么谁也不能Web应用程序。或者WebOS的,如果我理解正确的模型(还没有机会与人打还)。在所有这些,用户不终止任何东西 - 他们只是离开。 iPhone是有点不同,因为它只有presently允许一件事,在同一时间运行(只有少数例外),所以离开的行为暗示了相当立即终止该应用程序的。

Then neither can Web apps. 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)或code(通过完成())可以关闭你当前正在运行的活动。用户一般不需要其他任何东西,对于正确编写的应用程序,任何比他们更需要一个退出选项,使用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 apps.

没有两个应用环境是相同的,根据定义。这意味着,新出现的和其他人会淹没你可以看到在环境中的发展趋势。

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 apps 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 apps 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).

这需要更加注重应用程序的设计,专注于业务目标而不是绑在previous应用环境的实现模型坚持。谁没有时间或倾向做这个开发人员感到失望,这打破他们现有的心智模式较新的环境。这不是这两种环境的错,任何比它更是一座山的断层周边的它,而不是通过它流动的风暴。

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.

例如,某些开发环境中,像超卡和Smalltalk,有应用程序和开发工具共同混合在一个设置。这个概念并没有流行开来了,语言扩展以外的应用程序(例如,VBA在Excel中,LISP在AutoCAD)。开发谁想出了心智模式,presumed的应用程序本身的开发工具的存在,因此,无论是不得不改变他们的模型或限制自己的环境,他们的模型将成立。

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 apps as well (e.g., no "termination"). Or, conversely, someday if you do port your app to the Web, you may find that the Web app's flow may be a better match for Android, and you can revisit an Android port at that time.