Android Guides | Samples

Android.App.ActivityAttribute.MainLauncher Property

Whether or not the activity should be the main launcher for an application.

Syntax

public Boolean MainLauncher { get; set; }

Value

A Boolean specifying whether or not the activity should be the main launcher for the application.

Remarks

If MainLauncher is true, this is equivalent to placing an IntentFilterAttribute custom attribute on the type, specifying the Intent.ActionMain action and the Intent.CategoryLauncher category:

C# Example

[Activity (MainLauncher=true)]
class MyActivity : Activity {}

// ...is equivalent to...

[Activity]
[IntentFilter (new[]{Android.Content.Intent.ActionMain},
        Categories=new[]{Android.Content.Intent.CategoryLauncher})]
class MyActivity : Activity {}

which, in turn, generates the following XML fragment:

XML Example

<activity 
            android:label="MyActivity" 
            android:name="demo.MyActivity">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>

Requirements

Namespace: Android.App
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0