excludeFromRecents不与taskAffinity工作 [英] excludeFromRecents doesn't work with taskAffinity

查看:1030
本文介绍了excludeFromRecents不与taskAffinity工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能的复制: <一href="http://stackoverflow.com/questions/16482413/how-to-not-show-app-on-recent-apps-list-in-ics-excludefromrecents-doesnt-work">How到最近的应用程序列表中的ICS不显示应用程序? excludeFromRecents不起作用

比方说,我有两个活动的一个(主要活动)和B.我开始从A,B如下:

Let's say I have two activities A (the main activity) and B. I start B from A as follows:

    Intent i = new Intent(A.this, B.class);
    i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    startActivity(i);

我想我的应用程序已经在最近通话随时AND B只是一个入口在一个新的任务来启动。如果B有一个清单条目,如下所示,我做到这一点:

I want my app to have just one entry in the recents at any time AND B to be started at a new task. If B has a manifest entry as follows, I achieve that:

    <activity
        android:name="com.example.verysimpleactivity2.app.B"
        android:excludeFromRecents="true"
        android:label="B" ></activity>

不过,我也希望B有不同的taskAffinity比的主要活动,即:A。所以我改变了清单进入:

But I also want B to have a different taskAffinity than the main activity, i.e. A. So I change the manifest entry into:

    <activity
        android:name="com.example.verysimpleactivity2.app.B"
        android:excludeFromRecents="true"
        android:taskAffinity=""
        android:label="B" ></activity>

在这种情况下,如果B不在前台那么它不会在最近通话显示了,我只有一个(好!)但是,如果B是在前台和我preSS最近通话按钮,我看到A和B在那里。为什么显示在这种情况下的最近通话乙?如何确保我不会见B呢?

In this case, if B is not in the foreground then it does not show up in the recents and I only have A (good!) However, if B is in the foreground and I press recents button, I see both A and B there. Why is B shown in the recents in this case? How to make sure I don't see B at all?

推荐答案

显然,这是不可能实现我想要的(至少在奇巧)。

Apparently, it is impossible to achieve what I want (at least in KitKat).

来源:一个Android工程师

Source: an Android engineer

这篇关于excludeFromRecents不与taskAffinity工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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