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 がブログ投稿でそれを使用した場合、Google はこれが機能するシナリオを知っていると確信しています。前もって感謝します。