語言

Activity.OnNewIntent 方法

定義

多載

名稱 Description
OnNewIntent(Intent)

此功能用於將 launchMode 設定為「singleTop」的活動,或當客戶端在呼叫 Intent#FLAG_ACTIVITY_SINGLE_TOP時使用#startActivity該標誌。

OnNewIntent(Intent, ComponentCaller)

和 一樣 #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() 會在現有實例中被呼叫,並使用用於重新啟動該實例的 Intent。 活動在恢復狀態下永遠無法接收新的意圖。 你可以預期 onResume() 會在這個方法結束後被呼叫,但不一定是在回調完成後立即被呼叫。 若活動被恢復,將暫停並傳遞新的意圖,接著是 onResume()。 如果活動不在恢復狀態,則可以立即傳送新的意圖,並在活動再次啟用時呼叫 onResume()。 請注意 getIntent() 仍然回傳原始 Intent。 你可以使用 setIntent(Intent) 來更新成這個新的 Intent。

另請參閱:

Android 參考資料。android.app.Activity.onNewIntent

本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。

適用於

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()。 請注意,NewIntent(Intent)方法上你應該只覆蓋其中一個。

另請參閱:

Android 參考資料。android.app.Activity.onNewIntent

本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。

適用於