Partager via


Instrumentation.SetInTouchMode(Boolean) Method

Definition

Force the global system in or out of touch mode.

[Android.Runtime.Register("setInTouchMode", "(Z)V", "GetSetInTouchMode_ZHandler")]
public virtual void SetInTouchMode (bool inTouch);
[<Android.Runtime.Register("setInTouchMode", "(Z)V", "GetSetInTouchMode_ZHandler")>]
abstract member SetInTouchMode : bool -> unit
override this.SetInTouchMode : bool -> unit

Parameters

inTouch
Boolean

Set to true to be in touch mode, false to be in focus mode.

Attributes

Remarks

Force the global system in or out of touch mode. This can be used if your instrumentation relies on the UI being in one more or the other when it starts.

<b>Note:</b> Starting from Android Build.VERSION_CODES#TIRAMISU, this method will only take effect if the instrumentation was sourced from a process with MODIFY_TOUCH_MODE_STATE internal permission granted (shell already have it).

Java documentation for android.app.Instrumentation.setInTouchMode(boolean).

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