Android.App.LocalActivityManager.StartActivity Method
Start a new activity running in the group.

Syntax

[Android.Runtime.Register("startActivity", "(Ljava/lang/String;Landroid/content/Intent;)Landroid/view/Window;", "GetStartActivity_Ljava_lang_String_Landroid_content_Intent_Handler")]
public virtual Android.Views.Window StartActivity (string id, Android.Content.Intent intent)

Parameters

id
Unique identifier of the activity to be started
intent
The Intent describing the activity to be started

Returns

Documentation for this section has not yet been entered.

Exceptions

TypeReason
Android.Content.ActivityNotFoundException

Remarks

Start a new activity running in the group. Every activity you start must have a unique string ID associated with it -- this is used to keep track of the activity, so that if you later call startActivity() again on it the same activity object will be retained.

When there had previously been an activity started under this id, it may either be destroyed and a new one started, or the current one re-used, based on these conditions, in order:

  • If the Intent maps to a different activity component than is currently running, the current activity is finished and a new one started.
  • If the current activity uses a non-multiple launch mode (such as singleTop), or the Intent has the Android.Content.Intent.FLAG_ACTIVITY_SINGLE_TOP flag set, then the current activity will remain running and its Activity.OnNewIntent(Android.Content.Intent) method called.
  • If the new Intent is the same (excluding extras) as the previous one, and the new Intent does not have the Android.Content.Intent.FLAG_ACTIVITY_CLEAR_TOP set, then the current activity will remain running as-is.
  • Otherwise, the current activity will be finished and a new one started.

If the given Intent can not be resolved to an available Activity, this method throws Android.Content.ActivityNotFoundException.

Warning: There is an issue where, if the Intent does not include an explicit component, we can restore the state for a different activity class than was previously running when the state was saved (if the set of available activities changes between those points).

[Android Documentation]

Requirements

Namespace: Android.App
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 1