如果你的应用打开了其他应用程序的activity(好比浏览一张图片或是选择附件),那么有一个很重要的intent的标志需要了解:
Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET
如果不想让用户在Launcher或是桌面的快捷方式上重新打开你的应用时,再返回到你将要打开的其他程序的activity,就要使用这个标志。
例如:点击的是Gmail的图标,打开的却是选择图片的界面,因为这是你之前使用Gamil时的最后的操作,这会让人觉得很怪。
这个标志不会影响最近使用的程序列表或是后退按钮的功能,用户依然可以通过最近的程序列表返回到离开你应用时的状态。
原文:
If your application launches the activities of other applications (such as to view a picture or pick an attachment), there is an important intent flag to know:
Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET
Use this when starting an activity that you don't want the user to return to if they relaunch your application from the app launcher or a shortcut on the home screen. For example, it would be confusing to tap on the Gmail icon and find yourself selecting a picture because that is the last thing you had been doing as part of the Gmail task.
This flag doesn't impact how switching between recents or using the back button works, so the user can still return to your app in exactly the same state they left it by going through recents.