EGH*_*HDK 6 android android-intent back-stack android-sharing
我已经阅读了http://developer.android.com/guide/components/tasks-and-back-stack.html,我已查阅了相关文档FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET,但我仍然不明白为什么谷歌的员工决定将其包括在内它在他们关于分享的博客文章中.
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!”);
Run Code Online (Sandbox Code Playgroud)
文件说:
If set, this marks a point in the task's activity stack that should be cleared when the task is reset...
Run Code Online (Sandbox Code Playgroud)
我仍然不确定这面旗帜.我不确定我是否可以考虑将其包含在我的share()方法中,但如果Google在博客文章中使用它,那么我确信他们知道这种情况会发挥作用.提前致谢.
本文在第一个代码示例中解释了它:
此标志从活动堆栈中清除被调用的应用程序,因此用户下次重新启动此应用程序时会到达预期的位置.
如果您在返回时,你的应用程序(从主屏幕,从最近用过等)离开了标志,你会看到Activity,而不是您的份额的目标(短信/邮件/ IM应用程序)的.尝试一下,你会看到差异.
| 归档时间: |
|
| 查看次数: |
5953 次 |
| 最近记录: |