共用方式為


Intent.MakeMainSelectorActivity(String, String) Method

Definition

Make an Intent for the main activity of an application, without specifying a specific activity to run but giving a selector to find the activity.

[Android.Runtime.Register("makeMainSelectorActivity", "(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;", "")]
public static Android.Content.Intent? MakeMainSelectorActivity (string? selectorAction, string? selectorCategory);
[<Android.Runtime.Register("makeMainSelectorActivity", "(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;", "")>]
static member MakeMainSelectorActivity : string * string -> Android.Content.Intent

Parameters

selectorAction
String

The action name of the Intent's selector.

selectorCategory
String

The name of a category to add to the Intent's selector.

Returns

Returns a newly created Intent that can be used to launch the activity as a main application entry.

Attributes

Remarks

Make an Intent for the main activity of an application, without specifying a specific activity to run but giving a selector to find the activity. This results in a final Intent that is structured the same as when the application is launched from Home. For anything else that wants to launch an application in the same way, it is important that they use an Intent structured the same way, and can use this function to ensure this is the case.

The returned Intent has #ACTION_MAIN as its action, and includes the category #CATEGORY_LAUNCHER. This does <em>not</em> have #FLAG_ACTIVITY_NEW_TASK set, though typically you will want to do that through #addFlags(int) on the returned Intent.

Java documentation for android.content.Intent.makeMainSelectorActivity(java.lang.String, java.lang.String).

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