This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
被调用的前提条件:该 Activity 已经存在于任务栈中(BackStack) | |
1. 若该 Activity 的启动模式为 singleTop && 该 Activity 位于栈顶。再次启动该 Activity, onNewIntent 会被调用。 | |
2. 若该 Activity 的启动模式为 singleTask, singleInstance。再次启动该 Activity, onNewIntent 会被调用。 | |
3. 若该 Activity 的启动模式为 standard, onNewIntent 不会被调用,因为该模式的 Activity 每次都会启动都会创建一个新的实例, 与之前的无关。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Android 隐式意图用于在不同应用之间的组件跳转,隐式意图有一个组件的匹配过程。 | |
Intent 通过设置 action, category, data 来匹配到目标组件,而目标组件通过 intent-filter 标签来将自己注册为 Intent 处理者。 | |
匹配成功的依据是:Intent 的 action, category, data 必须为 Intent 处理者的子集。 | |
需要注意的是,startActivity(intent)会为 intent 设置 android.intent.category.DEFAULT 的 category。 |