語言

CrossProfileApps.StartMainActivity 方法

定義

多載

名稱 Description
StartMainActivity(ComponentName, UserHandle)

在指定的設定檔中啟動呼叫者套件的主要指定活動。

StartMainActivity(ComponentName, UserHandle, Activity, Bundle)

在指定的設定檔中啟動呼叫者套件的指定主要活動,並在指定的活動中啟動。

StartMainActivity(ComponentName, UserHandle)

在指定的設定檔中啟動呼叫者套件的主要指定活動。

[Android.Runtime.Register("startMainActivity", "(Landroid/content/ComponentName;Landroid/os/UserHandle;)V", "GetStartMainActivity_Landroid_content_ComponentName_Landroid_os_UserHandle_Handler", ApiSince=28)]
public virtual void StartMainActivity(Android.Content.ComponentName component, Android.OS.UserHandle targetUser);
[<Android.Runtime.Register("startMainActivity", "(Landroid/content/ComponentName;Landroid/os/UserHandle;)V", "GetStartMainActivity_Landroid_content_ComponentName_Landroid_os_UserHandle_Handler", ApiSince=28)>]
abstract member StartMainActivity : Android.Content.ComponentName * Android.OS.UserHandle -> unit
override this.StartMainActivity : Android.Content.ComponentName * Android.OS.UserHandle -> unit

參數

component
ComponentName

啟動活動的 ComponentName 必須匯出,且具有動作 android.content.Intent#ACTION_MAIN、 類別 android.content.Intent#CATEGORY_LAUNCHER。 否則,將拋出 SecurityException。

targetUser
UserHandle

該個人檔案的使用者名號必須是回傳的 #getTargetUserProfiles()使用者之一,否則會拋出 a SecurityException 。

屬性

備註

在指定的設定檔中啟動呼叫者套件的主要指定活動。

Java 文件 android.content.pm.CrossProfileApps.startMainActivity(android.content.ComponentName, android.os.UserHandle)。

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

適用於

StartMainActivity(ComponentName, UserHandle, Activity, Bundle)

在指定的設定檔中啟動呼叫者套件的指定主要活動,並在指定的活動中啟動。

[Android.Runtime.Register("startMainActivity", "(Landroid/content/ComponentName;Landroid/os/UserHandle;Landroid/app/Activity;Landroid/os/Bundle;)V", "GetStartMainActivity_Landroid_content_ComponentName_Landroid_os_UserHandle_Landroid_app_Activity_Landroid_os_Bundle_Handler", ApiSince=33)]
public virtual void StartMainActivity(Android.Content.ComponentName component, Android.OS.UserHandle targetUser, Android.App.Activity? callingActivity, Android.OS.Bundle? options);
[<Android.Runtime.Register("startMainActivity", "(Landroid/content/ComponentName;Landroid/os/UserHandle;Landroid/app/Activity;Landroid/os/Bundle;)V", "GetStartMainActivity_Landroid_content_ComponentName_Landroid_os_UserHandle_Landroid_app_Activity_Landroid_os_Bundle_Handler", ApiSince=33)>]
abstract member StartMainActivity : Android.Content.ComponentName * Android.OS.UserHandle * Android.App.Activity * Android.OS.Bundle -> unit
override this.StartMainActivity : Android.Content.ComponentName * Android.OS.UserHandle * Android.App.Activity * Android.OS.Bundle -> unit

參數

component
ComponentName

啟動活動的 ComponentName 必須匯出,且具有動作 android.content.Intent#ACTION_MAIN、 類別 android.content.Intent#CATEGORY_LAUNCHER。 否則,將拋出 SecurityException。

targetUser
UserHandle

該個人檔案的使用者名號必須是回傳的 #getTargetUserProfiles()使用者之一,否則會拋出 a SecurityException 。

callingActivity
Activity

用來決定新活動應屬於哪個任務的活動。 若 null,則活動將永遠從新任務開始。

options
Bundle

活動選項或 null。 參見 android.app.ActivityOptions。

屬性

備註

在指定的設定檔中啟動呼叫者套件的指定主要活動,並在指定的活動中啟動。

Java 文件 android.content.pm.CrossProfileApps.startMainActivity(android.content.ComponentName, android.os.UserHandle, android.app.Activity, android.os.Bundle)。

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

適用於