替代Intent.FLAG_ACTIVITY_CLEAR_TASK [英] Alternative to Intent.FLAG_ACTIVITY_CLEAR_TASK

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

问题描述

我有两个应用程序应用-B发射应用-A。如果用户启动应用程序b从内部在App-A应用AI通话结束,所以我没有任何问题。

I have two apps App-B launches App-A. If the user starts App B from inside App A I call finish on App-A so I have no problem.

如果用户去直接附录二从应用程序的抽屉或长pressing回家按钮,然后我实现了第一次申请所有的演员之前低于它清除在应用程序中的任务。这所期望的影响,但只适用于API 11.在较低的原料药在APP-A的新任务不会改变,群众演员putExtra将没有任何效果。任何替代 FLAG_ACTIVITY_CLEAR_TASK ?对于API< = 10

If the user goes straight to App B from the Application drawer or long pressing home button then I implement the below which clears the task in App A first before applying all the extras. This has the desired affect but only works on API 11. On lower APIs the new task in APP-A will not change and extras putExtra will have no effect. Any alternative to FLAG_ACTIVITY_CLEAR_TASK? for API <=10?

        Intent i = new Intent("com.App-A");
    i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);

感谢

杰森

推荐答案

新的<一个href="http://developer.android.com/reference/android/support/v4/content/IntentCompat.html#FLAG_ACTIVITY_CLEAR_TASK"相对=nofollow> IntentCompat 应该已经帮助上,但显然标志被忽略的API低于11。

The new IntentCompat should've helped on that, but apparently the flag is ignored for API lower than 11.

要使用IntentCompat做到以下几点:

To use IntentCompat do following:

intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK |
IntentCompat.FLAG_ACTIVITY_CLEAR_TASK);

这篇关于替代Intent.FLAG_ACTIVITY_CLEAR_TASK的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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