Android Guides | Samples

Android.App.ActivityAttribute Class

Generates a /manifest/application/activity element within AndroidManifest.xml.

See Also: ActivityAttribute


[System.AttributeUsage(System.AttributeTargets.Class, AllowMultiple=false, Inherited=false)]
public sealed class ActivityAttribute : Attribute


The //activity element is used to declare an activity that implements part of the application's visual user interface. The ActivityAttribute custom attribute is used by monodroid.exe when generating AndroidManifest.xml to to declaratively generate //activity elements.

The type this attribute is placed on must be a (possibly indirect) subclass of Activity.

The following type declaration

C# Example

[Activity (Name="mono.samples.HelloApp", 
        Label="Hello! Wie gehts!", 
class MyActivity : Activity {

results in the following XML fragment

XML Example

<activity android:configChanges="mcc|mnc"
            android:label="Hello! Wie gehts!" 
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />


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

The members of Android.App.ActivityAttribute are listed below.

See Also: Attribute

Public Constructors

Constructs and initializes a new ActivityAttribute instance.

Public Properties

AllowTaskReparentingBoolean. Whether or not the activity can move from the tasdk that started it to the task it has an affinity for.
AlwaysRetainTaskStateBoolean. Whether or not the state of the task that the activity is in will always be maintained by the system.
ClearTaskOnLaunchBoolean. Whether or not all activities will be removed from the task, except for the root activity, whenever it is re-launched from the home screen.
ConfigurationChangesConfigChanges. The configuration changes that the activity will handle itself.
EnabledBoolean. Whether or not the activity can be instantiated by the system.
ExcludeFromRecentsBoolean. Whether or not the activity should be excluded from the list of recently launched activities.
ExportedBoolean. Whether or not the activity can be launched by components of other applications.
FinishOnTaskLaunchBoolean. Whether or not an existing instance of the activity should be shut down whenever the user again launches its task.
IconString. An icon representing the activity.
LabelString. A user-readable label for the activity.
LaunchModeLaunchMode. How the activity should be launched.
MainLauncherBoolean. Whether or not the activity should be the main launcher for an application.
MultiProcessBoolean. Whether an instance of the activity can be launched into the process of the component that started it.
NameString. The name of the class that implements the activity.
NoHistoryBoolean. Whether or not the activity should be removed from the activity stack and finished when the user navigates away.
PermissionString. The name of a permission that clients must have to launch the activity.
ProcessString. The name of the process in which the activity should run.
ScreenOrientationScreenOrientation. The orientation of the activity's display on the device.
StateNotNeededBoolean. Whether or not the activity can be killed and successfully restarted without having saved its state.
TaskAffinityString. The task that the activity has an affinity for.
ThemeString. A reference to a style resource defining an overall theme for the activity.
WindowSoftInputModeSoftInput. How the main window of the activity interacts with the window containing hte on-screen soft keyboard.