Compartilhar via


Instrumentation.UiAutomation Property

Definition

Gets the UiAutomation instance with no flags set.

public virtual Android.App.UiAutomation? UiAutomation { [Android.Runtime.Register("getUiAutomation", "()Landroid/app/UiAutomation;", "GetGetUiAutomationHandler")] get; }
[<get: Android.Runtime.Register("getUiAutomation", "()Landroid/app/UiAutomation;", "GetGetUiAutomationHandler")>]
member this.UiAutomation : Android.App.UiAutomation

Property Value

The UI automation instance.

Attributes

Remarks

Gets the UiAutomation instance with no flags set.

<strong>Note:</strong> The APIs exposed via the returned UiAutomation work across application boundaries while the APIs exposed by the instrumentation do not. For example, Instrumentation#sendPointerSync(MotionEvent) will not allow you to inject the event in an app different from the instrumentation target, while UiAutomation#injectInputEvent(android.view.InputEvent, boolean) will work regardless of the current application.

A typical test case should be using either the UiAutomation or Instrumentation APIs. Using both APIs at the same time is not a mistake by itself but a client has to be aware of the APIs limitations.

Equivalent to getUiAutomation(0). If a UiAutomation exists with different flags, the flags on that instance will be changed, and then it will be returned.

Compatibility mode: This method is infallible for apps targeted for Build.VERSION_CODES#R and earlier versions; for apps targeted for later versions, it will return null if UiAutomation fails to connect. The caller can check the return value and retry on error.

Java documentation for android.app.Instrumentation.getUiAutomation().

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

See also