android – 共享时“FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET”的目的是什么?

我已阅读,http://developer.android.com/guide/components/tasks-and-back-stack.html并且我查找了FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET的文档,但我仍然不明白为什么Google的员工决定将其包含在他们关于共享的博客文章中.

http://android-developers.blogspot.com/2012/02/share-with-intents.html

这是他们的代码片段:

Intent intent=new Intent(android.content.Intent.ACTION_SEND);
intent.setType("text/plain");
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);

// Add data to the intent,the receiving app will decide what to do with it.
intent.putExtra(Intent.EXTRA_SUBJECT,“Some Subject Line”);
intent.putExtra(Intent.EXTRA_TEXT,“Body of the message,woot!”);

文件说:

If set,this marks a point in the task's activity stack that should be cleared when the task is reset...

我仍然不确定这面旗帜.我不确定我是否可以考虑将其包含在我的share()方法中,但如果Google在博客文章中使用它,那么我确信他们知道这种情况会发挥作用.提前致谢.

解决方法

本文在第一个代码示例中解释了它:

This flag clears the called app from the activity stack,so users
arrive in the expected place next time this application is restarted.

如果你遗漏了国旗,当你回到你的应用程序时(从主屏幕,从最近等),你会看到共享目标的活动(消息/邮件/ IM应用程序),而不是你的.尝试一下,你会看到差异.

相关文章

Android性能优化——之控件的优化 前面讲了图像的优化,接下...
前言 上一篇已经讲了如何实现textView中粗字体效果,里面主要...
最近项目重构,涉及到了数据库和文件下载,发现GreenDao这个...
WebView加载页面的两种方式 一、加载网络页面 加载网络页面,...
给APP全局设置字体主要分为两个方面来介绍 一、给原生界面设...
前言 最近UI大牛出了一版新的效果图,按照IOS的效果做的,页...