Instrumentation.WaitForMonitorWithTimeout Method

Definition

Wait for an existing ActivityMonitor to be hit till the timeout expires.

[Android.Runtime.Register("waitForMonitorWithTimeout", "(Landroid/app/Instrumentation$ActivityMonitor;J)Landroid/app/Activity;", "GetWaitForMonitorWithTimeout_Landroid_app_Instrumentation_ActivityMonitor_JHandler")]
public virtual Android.App.Activity? WaitForMonitorWithTimeout(Android.App.Instrumentation.ActivityMonitor? monitor, long timeOut);
[<Android.Runtime.Register("waitForMonitorWithTimeout", "(Landroid/app/Instrumentation$ActivityMonitor;J)Landroid/app/Activity;", "GetWaitForMonitorWithTimeout_Landroid_app_Instrumentation_ActivityMonitor_JHandler")>]
abstract member WaitForMonitorWithTimeout : Android.App.Instrumentation.ActivityMonitor * int64 -> Android.App.Activity
override this.WaitForMonitorWithTimeout : Android.App.Instrumentation.ActivityMonitor * int64 -> Android.App.Activity

Parameters

monitor
Instrumentation.ActivityMonitor

Instrumentation.ActivityMonitor: The ActivityMonitor to wait for.

timeOut
Int64

long: The timeout value in milliseconds.

Returns

The Activity object that matched the monitor.

Attributes

Remarks

Wait for an existing ActivityMonitor to be hit till the timeout expires. Once the monitor has been hit, it is removed from the activity monitor list and the first created Activity object that matched it is returned. If the timeout expires, a null object is returned.

Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.

Last updated 2026-08-03 UTC.

Android reference for android.app.Instrumentation.waitForMonitorWithTimeout.

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