Language

Instrumentation.ActivityMonitor.OnStartActivity(Intent) Method

Definition

Used for intercepting any started activity.

[Android.Runtime.Register("onStartActivity", "(Landroid/content/Intent;)Landroid/app/Instrumentation$ActivityResult;", "GetOnStartActivity_Landroid_content_Intent_Handler", ApiSince=26)]
public virtual Android.App.Instrumentation.ActivityResult OnStartActivity(Android.Content.Intent intent);
[<Android.Runtime.Register("onStartActivity", "(Landroid/content/Intent;)Landroid/app/Instrumentation$ActivityResult;", "GetOnStartActivity_Landroid_content_Intent_Handler", ApiSince=26)>]
abstract member OnStartActivity : Android.Content.Intent -> Android.App.Instrumentation.ActivityResult
override this.OnStartActivity : Android.Content.Intent -> Android.App.Instrumentation.ActivityResult

Parameters

intent
Intent

Intent: The intent used for starting the activity.

Returns

The ActivityResult that needs to be used in case of a match.

Attributes

Remarks

Used for intercepting any started activity. A non-null return value here will be considered a hit for this monitor. By default this will return null and subclasses can override this to return a non-null value if the intent needs to be intercepted. Whenever a new activity is started, this method will be called on instances created using ActivityMonitor() to check if there is a match. In case of a match, the activity start will be blocked and the returned result will be used.

Android reference for android.app.Instrumentation.ActivityMonitor.onStartActivity.

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