Android.App.Activity.StartActivityIfNeeded Method
A special variation to launch an activity only if a new activity instance is needed to handle the given Intent.

Syntax

[Android.Runtime.Register("startActivityIfNeeded", "(Landroid/content/Intent;ILandroid/os/Bundle;)Z", "GetStartActivityIfNeeded_Landroid_content_Intent_ILandroid_os_Bundle_Handler")]
public virtual bool StartActivityIfNeeded (Android.Content.Intent intent, int requestCode, Android.OS.Bundle options)

See Also

Activity.StartActivityForResult(Android.Content.Intent, System.Int32)

Parameters

intent
The intent to start.
requestCode
If >= 0, this code will be returned in onActivityResult() when the activity exits, as described in Activity.StartActivityForResult(Android.Content.Intent, System.Int32).
options
Additional options for how the Activity should be started. See Android.Content.Context.StartActivity(Android.Content.Intent, Android.OS.Bundle) for more details.

Returns

Documentation for this section has not yet been entered.

Remarks

A special variation to launch an activity only if a new activity instance is needed to handle the given Intent. In other words, this is just like Activity.StartActivityForResult(Android.Content.Intent, System.Int32) except: if you are using the Android.Content.Intent.FLAG_ACTIVITY_SINGLE_TOP flag, or singleTask or singleTop NoType:android/R$styleable;Href=../../../reference/android/R.styleable.html#AndroidManifestActivity_launchMode, and the activity that handles intent is the same as your currently running activity, then a new instance is not needed. In this case, instead of the normal behavior of calling Activity.OnNewIntent(Android.Content.Intent) this function will return and you can handle the Intent yourself.

This function can only be called from a top-level activity; if it is called from a child activity, a runtime exception will be thrown.

[Android Documentation]

Requirements

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