語言

Activity.CurrentCaller 屬性

定義

透過 或 #onNewIntent返回重新啟動此活動的#onActivityResult應用程式 ComponentCaller 實例。

public virtual Android.App.ComponentCaller CurrentCaller { [Android.Runtime.Register("getCurrentCaller", "()Landroid/app/ComponentCaller;", "GetGetCurrentCallerHandler", ApiSince=35)] get; }
[<get: Android.Runtime.Register("getCurrentCaller", "()Landroid/app/ComponentCaller;", "GetGetCurrentCallerHandler", ApiSince=35)>]
member this.CurrentCaller : Android.App.ComponentCaller

屬性值

ComponentCaller IEnumerable 執行個體

屬性

備註

回傳該應用程式的 ComponentCaller 實例,該應用程式透過 onNewIntent(Intent) 或 onActivityResult(int, int, Intent) 重新啟動此活動。 請注意,此方法僅能在 onNewIntent(Intent) 和 onActivityResult(int, int, Intent) 兩個方法中運作。 如果你在 onNewIntent(Intent) 和 onActivityResult(int, int, Intent) 之外呼叫此方法,它會拋出 IllegalStateException。 你也可以在 onNewIntent(Intent,ComponentCaller)或 onActivityResult(int, int, Intent, ComponentCaller) 上覆寫時,取得呼叫者。 若要保留 ComponentCaller 實例以備未來使用,請呼叫 setIntent(Intent,ComponentCaller),並使用 getCaller() 來擷取。

另請參閱:

拋出:IllegalStateException 如果呼叫者為空,表示該方法在 onNewIntent(Intent) 外部被呼叫

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

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

適用於