Activity.OnNewIntent 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
重载
| 名称 | 说明 |
|---|---|
| OnNewIntent(Intent) |
这将针对在其包中将 launchMode 设置为“singleTop”的活动调用,或者客户端在调用 |
| OnNewIntent(Intent, ComponentCaller) |
同样 |
OnNewIntent(Intent)
这将针对在其包中将 launchMode 设置为“singleTop”的活动调用,或者客户端在调用Intent#FLAG_ACTIVITY_SINGLE_TOP时使用了#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
参数
- intent
- Intent
用于启动活动的新意向
- 特性
注解
这将针对在其包中将 launchMode 设置为“singleTop”的活动调用,或者客户端在调用 startActivity(Intent)时使用了Intent.FLAG_ACTIVITY_SINGLE_TOP标志。 在任一情况下,当活动在活动堆栈顶部重新启动时(而不是启动活动的新实例)时,将使用用于重新启动它的意向在现有实例上调用 onNewIntent()。 活动永远无法收到处于恢复状态的新意向。 可以指望在此方法后调用 onResume(),但此回调完成后不一定立即调用。 如果恢复活动,它将暂停,并传递新的意向,后跟 onResume()。 如果活动未处于恢复状态,则可以立即传递新意向,并在活动再次激活时调用 onResume()。 请注意,getIntent() 仍返回原始意向。 可以使用 setIntent(Intent) 将其更新为此新意向。
Android 参考。android.app.Activity.onNewIntent
本页的某些部分是根据 创建和共享的工作进行的修改,并根据 许可证中所述的条款使用。
另请参阅
适用于
OnNewIntent(Intent, ComponentCaller)
同样 #onNewIntent(Intent),但与发送意向的应用关联的 ComponentCaller 实例具有额外的参数。
[Android.Runtime.Register("onNewIntent", "(Landroid/content/Intent;Landroid/app/ComponentCaller;)V", "GetOnNewIntent_Landroid_content_Intent_Landroid_app_ComponentCaller_Handler", ApiSince=35)]
public virtual void OnNewIntent(Android.Content.Intent intent, Android.App.ComponentCaller caller);
[<Android.Runtime.Register("onNewIntent", "(Landroid/content/Intent;Landroid/app/ComponentCaller;)V", "GetOnNewIntent_Landroid_content_Intent_Landroid_app_ComponentCaller_Handler", ApiSince=35)>]
abstract member OnNewIntent : Android.Content.Intent * Android.App.ComponentCaller -> unit
override this.OnNewIntent : Android.Content.Intent * Android.App.ComponentCaller -> unit
参数
- intent
- Intent
用于启动活动的新意向
- caller
- ComponentCaller
与 ComponentCaller 发送意向的应用关联的实例
- 特性
注解
与 onNewIntent(Intent)相同,但与发送意向的应用关联的 ComponentCaller 实例具有额外的参数。 如果要检索调用方而不重写此方法,请在现有 onNewIntent(Intent)内调用 getCurrentCaller()。 请注意,应仅重写一个 onNewIntent(Intent) 方法。
Android 参考。android.app.Activity.onNewIntent
本页的某些部分是根据 创建和共享的工作进行的修改,并根据 许可证中所述的条款使用。