隐藏活动 [英] Hide an activity

查看:98
本文介绍了隐藏活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从我的活动我开始一个Intent(上传图片),然后我等待结果(onActivityResult)。

From my Activity I start an Intent (uploading a picture) and then I wait for result (onActivityResult).

我如何隐藏我的活动,因此它可以处理意图导致背景? moveTaskToBack(真)隐藏了整个应用程序,但我只需要找回了previous活动没有完成当前的。

How can I hide my Activity so it could handle the Intents result in a background? moveTaskToBack(true) hides the whole application, but I need just to get back to the previous Activity without finishing the current one.

推荐答案

由于Android的文件解释说,活动是显示的界面给用户:

As Android documentation explains, Activities are for displaying an interface to the user:

这是活动重新presents带有用户界面的单个屏幕。例如,电子邮件应用程序可能有一个活动,显示新的电子邮件列表,另一个活动撰写的电子邮件,以及阅读电子邮件其他活动。虽然活动一起工作,以形成在电子邮件应用程序中的凝聚力的用户体验,每一个都独立于其他的。因此,不同的应用程序可以就这些活动中的任何一个(如果电子邮件应用程序允许它)。例如,相机应用可以就在构成新的邮件,在为了使用户共享一个图象的电子邮件应用程序的活性。

An activity represents a single screen with a user interface. For example, an email application might have one activity that shows a list of new emails, another activity to compose an email, and another activity for reading emails. Although the activities work together to form a cohesive user experience in the email application, each one is independent of the others. As such, a different application can start any one of these activities (if the email application allows it). For example, a camera application can start the activity in the email application that composes new mail, in order for the user to share a picture.

我建议你阅读整个文章

如果你想要做的东西在后台,你可以用 主题 的AsyncTask ,甚至服务。更多的从这个文档阅读为您提供有关如何将这些样的东西应该在Android中处理更多的信息。

If you want to do something in background, you can use Thread, AsyncTask, or even a Service. Reading more from this documentation gives you more info about how these kind of things should be handled in Android.

这篇关于隐藏活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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