Intent.MakeMainActivity(ComponentName) Method

Definition

Create an intent to launch the main (root) activity of a task.

[Android.Runtime.Register("makeMainActivity", "(Landroid/content/ComponentName;)Landroid/content/Intent;", "")]
public static Android.Content.Intent? MakeMainActivity (Android.Content.ComponentName? mainActivity);
[<Android.Runtime.Register("makeMainActivity", "(Landroid/content/ComponentName;)Landroid/content/Intent;", "")>]
static member MakeMainActivity : Android.Content.ComponentName -> Android.Content.Intent

Parameters

mainActivity
ComponentName

The main activity component that this Intent will launch.

Returns

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

Attributes

Remarks

Create an intent to launch the main (root) activity of a task. This is the Intent that is started when the application's 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 the given Activity component as its explicit component, #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.makeMainActivity(android.content.ComponentName).

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