AccessibilityNodeInfo.SetQueryFromAppProcessEnabled(View, Boolean) Method

Definition

Connects this node to the View's root so that operations on this node can query the entire AccessibilityNodeInfo tree and perform accessibility actions on nodes.

[Android.Runtime.Register("setQueryFromAppProcessEnabled", "(Landroid/view/View;Z)V", "GetSetQueryFromAppProcessEnabled_Landroid_view_View_ZHandler", ApiSince=34)]
public virtual void SetQueryFromAppProcessEnabled (Android.Views.View view, bool enabled);
[<Android.Runtime.Register("setQueryFromAppProcessEnabled", "(Landroid/view/View;Z)V", "GetSetQueryFromAppProcessEnabled_Landroid_view_View_ZHandler", ApiSince=34)>]
abstract member SetQueryFromAppProcessEnabled : Android.Views.View * bool -> unit
override this.SetQueryFromAppProcessEnabled : Android.Views.View * bool -> unit

Parameters

view
View

The view that generated this node, or any view in the same view-root hierarchy.

enabled
Boolean

Whether to enable (true) or disable (false) querying from the app process.

Attributes

Remarks

Connects this node to the View's root so that operations on this node can query the entire AccessibilityNodeInfo tree and perform accessibility actions on nodes.

Testing or debugging tools should create this AccessibilityNodeInfo node using View#createAccessibilityNodeInfo() or AccessibilityNodeProvider and call this method, then navigate and interact with the node tree by calling methods on the node. Calling this method more than once on the same node is a no-op. After calling this method, all nodes linked to this node (children, ancestors, etc.) are also queryable.

Here "query" refers to the following node operations: <li>check properties of this node (example: #isScrollable())</li> <li>find and query children (example: #getChild(int))</li> <li>find and query the parent (example: #getParent())</li> <li>find focus (examples: #findFocus(int), #focusSearch(int))</li> <li>find and query other nodes (example: #findAccessibilityNodeInfosByText(String), #findAccessibilityNodeInfosByViewId(String))</li> <li>perform actions (example: #performAction(int))</li>

This is intended for short-lived inspections from testing or debugging tools in the app process, as operations on this node tree will only succeed as long as the associated view hierarchy remains attached to a window. AccessibilityNodeInfo objects can quickly become out of sync with their corresponding View objects; if you wish to inspect a changed or different view hierarchy then create a new node from any view in that hierarchy and call this method on that new node, instead of disabling & re-enabling the connection on the previous node.

Java documentation for android.view.accessibility.AccessibilityNodeInfo.setQueryFromAppProcessEnabled(android.view.View, 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