次の方法で共有


Activity.OnNewIntent(Intent) Method

Definition

This is called for activities that set launchMode to "singleTop" in their package, or if a client used the Intent#FLAG_ACTIVITY_SINGLE_TOP flag when calling #startActivity.

[Android.Runtime.Register("onNewIntent", "(Landroid/content/Intent;)V", "GetOnNewIntent_Landroid_content_Intent_Handler")]
protected virtual void OnNewIntent (Android.Content.Intent? intent);
[<Android.Runtime.Register("onNewIntent", "(Landroid/content/Intent;)V", "GetOnNewIntent_Landroid_content_Intent_Handler")>]
abstract member OnNewIntent : Android.Content.Intent -> unit
override this.OnNewIntent : Android.Content.Intent -> unit

Parameters

intent
Intent

The new intent that was started for the activity.

Attributes

Remarks

This is called for activities that set launchMode to "singleTop" in their package, or if a client used the Intent#FLAG_ACTIVITY_SINGLE_TOP flag when calling #startActivity. 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 can never receive a new intent in the resumed state. You can count on #onResume being called after this method, though not necessarily immediately after the completion this callback. If the activity was resumed, it will be paused and new intent will be delivered, followed by #onResume. If the activity wasn't in the resumed state, then new intent can be delivered immediately, with #onResume() called sometime later when activity becomes active again.

Note that #getIntent still returns the original Intent. You can use #setIntent to update it to this new Intent.

Java documentation for android.app.Activity.onNewIntent(android.content.Intent).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

See also