如何正确地从singleTop活动中清除意图数据? [英] How to properly clear intent data from singleTop Activity?

查看:77
本文介绍了如何正确地从singleTop活动中清除意图数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

方案是: 在清单中声明了singleTop的活动.这项活动有一些额外要求.我能够清除意图数据并能够翻转屏幕,而无需将原始意图称为...

Scenario is: Activity with singleTop declared at the manifest. This activity is called with some extras. I'm able to clear the intent data and be able to flip screen and such without the original intent being called...

问题在于,当该活动被系统杀死并且用户返回到该活动时,它会使用用于创建该活动的原始意图重新启动.

The issue is that when the activity is killed by the system and the user goes back to this activity it gets restarted using the original intent used to create the activity.

如何删除此内容?我尝试使用新的Intent从内部开始相同的活动,但是没有运气...我还使用了各种标志.

How do I remove this? I tried starting the same activity from within with a new Intent but no luck... I have also used various flags.

推荐答案

事实证明,没有一种正确的方法可以从ActivityManager中清除意图数据.解决此错误的唯一方法是保留标记状态,以防其他事件被清除.请参阅以下有关保留标志的帖子. https://groups.google.com/forum/#!topic/android -developers/vrLdM5mKeoY

Well turns out that there isn't a proper way to clear intent data from the ActivityManager. The only way around this bug is to keep a flag state for when extras have been cleared. Please see the following post about keeping a flag. https://groups.google.com/forum/#!topic/android-developers/vrLdM5mKeoY

这篇关于如何正确地从singleTop活动中清除意图数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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