singleTask和singleInstance应该用在ACTION_MAIN且CATEGORY_LAUNCHER的Activity上

来源:互联网 发布:知乎45回答 编辑:程序博客网 时间:2024/06/18 08:45

singleTask和singleInstance一般只能用在有ACTION_MAIN且CATEGORY_LAUNCHER过滤器的Activity上。原因如下:

Imagine, for example, what could happen if the filter is missing: An intent launches a"singleTask" activity, initiating a new task, and the user spends some time working in that task. The user then presses the Home button. The task is now sent to the background and is not visible. Now the user has no way to return to the task, because it is not represented in the application launcher.

原创粉丝点击