发送活动为背景,进行整理 [英] Sending Activity to background with out finishing

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

问题描述

我怎样才能让一个活动去后台,无需调用它的完成()方法,并返回到初一家长活动?我想了这么多,但我无法找到一个解决方案。所以,如果你们能帮助我将非常感激。

How can I make an activity go to background without calling its finish() method and return to the Parent activity that started this? I tried so much but I could not find a solution. So if you guys could help I would be very thankful.

推荐答案

以下将工作,如果该活动是在一个不同的任务,其母公司运行。要做到这一点,请参阅<一href="http://developer.android.com/guide/topics/manifest/activity-element.html#lmode">http://developer.android.com/guide/topics/manifest/activity-element.html#lmode.

The following will work if the Activity is running in a different task to its parent. To achieve this, see http://developer.android.com/guide/topics/manifest/activity-element.html#lmode.

public void onBackPressed () {
    moveTaskToBack (true);
}

当前任务将被隐藏,但是它的状态将保持不变,而当它被重新激活它会出现只是因为它当你离开它是

The current task will be hidden, but its state will remain untouched, and when it is reactivated it will appear just as it was when you left it.

这篇关于发送活动为背景,进行整理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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