protected void onNewIntent(Intent intent)
This is called for activities that set launchMode to "singleTop" in their package, or if a client used the FLAG_ACTIVITY_SINGLE_TOP
flag when calling startActivity(Intent)
. In either case, when the activity is re-launched while at the top of the activity stack instead of a new instance of the activity being started, onNewIntent() will be called on the existing instance with the Intent that was used to re-launch it.
An activity will always be paused before receiving a new intent, so you can count on onResume()
being called after this method.
Note that getIntent()
still returns the original Intent. You can use setIntent(Intent)
to update it to this new Intent.
Parameters
intent | The new intent that was started for the activity. |
---|
See Also
FLAG_ACTIVITY_SINGLE_TOP 。
如果重新启动这个 Activity A,当 A 位于栈顶时(这样 A 不用新建实例),onNewIntent 将会被调用。