AccessibilityNodeInfoCompat

Added in 1.1.0

class AccessibilityNodeInfoCompat


Helper for accessing android.view.accessibility.AccessibilityNodeInfo in a backwards compatible fashion.

Summary

Nested types

A class defining an action that can be performed on an AccessibilityNodeInfo.

Class with information if a node is a collection.

Class for building CollectionInfoCompat objects.

Class with information if a node is a collection item.

Builder for creating CollectionItemInfoCompat objects.

Class with information if a node is a range.

Class with information of touch delegated views and regions.

Constants

const Int

Action that gives accessibility focus to the node.

const String!
ACTION_ARGUMENT_COLUMN_INT = "android.view.accessibility.action.ARGUMENT_COLUMN_INT"

Argument for specifying the collection column to make visible on screen.

const String!
ACTION_ARGUMENT_DIRECTION_INT = "androidx.core.view.accessibility.action.ARGUMENT_DIRECTION_INT"

Argument to represent the direction when using ACTION_SCROLL_IN_DIRECTION.

const String!
ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN = "ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN"

Argument for whether when moving at granularity to extend the selection or to move it otherwise.

const String!
ACTION_ARGUMENT_HTML_ELEMENT_STRING = "ACTION_ARGUMENT_HTML_ELEMENT_STRING"

Argument for which HTML element to get moving to the next/previous HTML element.

const String!
ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT = "ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT"

Argument for which movement granularity to be used when traversing the node text.

const String!
ACTION_ARGUMENT_MOVE_WINDOW_X = "ACTION_ARGUMENT_MOVE_WINDOW_X"

Argument for specifying the x coordinate to which to move a window.

const String!
ACTION_ARGUMENT_MOVE_WINDOW_Y = "ACTION_ARGUMENT_MOVE_WINDOW_Y"

Argument for specifying the y coordinate to which to move a window.

const String!
ACTION_ARGUMENT_PRESS_AND_HOLD_DURATION_MILLIS_INT = "android.view.accessibility.action.ARGUMENT_PRESS_AND_HOLD_DURATION_MILLIS_INT"

Argument to represent the duration in milliseconds to press and hold a node.

const String!
ACTION_ARGUMENT_PROGRESS_VALUE = "android.view.accessibility.action.ARGUMENT_PROGRESS_VALUE"

Argument for specifying the progress value to set.

const String!
ACTION_ARGUMENT_ROW_INT = "android.view.accessibility.action.ARGUMENT_ROW_INT"

Argument for specifying the collection row to make visible on screen.

const String!
ACTION_ARGUMENT_SCROLL_AMOUNT_FLOAT = "androidx.core.view.accessibility.action.ARGUMENT_SCROLL_AMOUNT_FLOAT"

Argument to represent the scroll amount as a percent of the visible area of a node, with 1.0F as the default.

const String!
ACTION_ARGUMENT_SELECTION_END_INT = "ACTION_ARGUMENT_SELECTION_END_INT"

Argument for specifying the selection end.

const String!
ACTION_ARGUMENT_SELECTION_START_INT = "ACTION_ARGUMENT_SELECTION_START_INT"

Argument for specifying the selection start.

const String!
ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE = "ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE"

Argument for specifying the text content to set

const Int

Action that clears accessibility focus of the node.

const Int

Action that unfocuses the node.

const Int

Action that unselects the node.

const Int

Action that clicks on the node info.

const Int

Action to collapse an expandable node.

const Int
ACTION_COPY = 16384

Action to copy the current selection to the clipboard.

const Int
ACTION_CUT = 65536

Action to cut the current selection and place it to the clipboard.

const Int
ACTION_DISMISS = 1048576

Action to dismiss a dismissible node.

const Int
ACTION_EXPAND = 262144

Action to expand an expandable node.

const Int

Action that focuses the node.

const Int

Action that long clicks on the node.

const Int

Action that requests to go to the next entity in this node's text at a given movement granularity.

const Int

Action to move to the next HTML element of a given type.

const Int
ACTION_PASTE = 32768

Action to paste the current clipboard content.

const Int

Action that requests to go to the previous entity in this node's text at a given movement granularity.

const Int

Action to move to the previous HTML element of a given type.

const Int

Action to scroll the node content backward.

const Int

Action to scroll the node content forward.

const Int

Action that selects the node.

const Int

Action to set the selection.

const Int
ACTION_SET_TEXT = 2097152

Action that sets the text of the node.

const String!
EXTRA_DATA_TEXT_CHARACTER_LOCATION_ARG_LENGTH = "android.view.accessibility.extra.DATA_TEXT_CHARACTER_LOCATION_ARG_LENGTH"

Integer argument specifying the end index of the requested text location data.

const Int

The maximum allowed length of the requested text location data.

const String!
EXTRA_DATA_TEXT_CHARACTER_LOCATION_ARG_START_INDEX = "android.view.accessibility.extra.DATA_TEXT_CHARACTER_LOCATION_ARG_START_INDEX"

Integer argument specifying the start index of the requested text location data.

const String!
EXTRA_DATA_TEXT_CHARACTER_LOCATION_KEY = "android.view.accessibility.extra.DATA_TEXT_CHARACTER_LOCATION_KEY"

Key used to request and locate extra data for text character location.

const Int

Prefetching strategy that prefetches the ancestors of the requested node.

const Int

Prefetching strategy that prefetches the descendants of the requested node breadth-first.

const Int

Prefetching strategy that prefetches the descendants of the requested node depth-first.

const Int

Prefetching strategy that prefetches the descendants in a hybrid depth first and breadth first approach.

const Int

Prefetching strategy that prefetches the siblings of the requested node.

const Int

Prefetching flag that specifies prefetching should not be interrupted by a request to retrieve a node or perform an action on a node.

const Int

The accessibility focus.

const Int

The input focus.

const Int

Maximum batch size of prefetched nodes for a request.

const Int

Movement granularity bit for traversing the text of a node by character.

const Int

Movement granularity bit for traversing the text of a node by line.

const Int

Movement granularity bit for traversing the text of a node by page.

const Int

Movement granularity bit for traversing the text of a node by paragraph.

const Int

Movement granularity bit for traversing the text of a node by word.

Public constructors

This function is deprecated.

Use wrap instead.

Public functions

Unit

Adds an action that can be performed on the node.

Unit
addAction(action: Int)

Adds an action that can be performed on the node.

Unit
addChild(child: View!)

Adds a child.

Unit
addChild(root: View!, virtualDescendantId: Int)

Adds a virtual child which is a descendant of the given root.

Boolean

Gets if this node opens a popup or a dialog.

Boolean
equals(obj: Any!)
(Mutable)List<AccessibilityNodeInfoCompat!>!

Finds android.view.accessibility.AccessibilityNodeInfos by text.

(Mutable)List<AccessibilityNodeInfoCompat!>!

Finds AccessibilityNodeInfoCompats by the fully qualified view id's resource name where a fully qualified id is of the from "package:id/id_resource_name".

AccessibilityNodeInfoCompat!
findFocus(focus: Int)

Find the view that has the specified focus type.

AccessibilityNodeInfoCompat!
focusSearch(direction: Int)

Searches for the nearest view in the specified direction that can take input focus.

(Mutable)List<AccessibilityNodeInfoCompat.AccessibilityActionCompat!>!

Gets the actions that can be performed on the node.

Int

This function is deprecated.

Use getActionList instead.

(Mutable)List<String!>

Get the extra data available for this node.

Unit
getBoundsInParent(outBounds: Rect!)

This function is deprecated.

Use getBoundsInScreen instead.

Unit
getBoundsInScreen(outBounds: Rect!)

Gets the node bounds in screen coordinates.

Unit
getBoundsInWindow(outBounds: Rect)

Gets the node bounds in window coordinates.

AccessibilityNodeInfoCompat!
getChild(index: Int)

Get the child at given index.

AccessibilityNodeInfoCompat?
getChild(index: Int, prefetchingStrategy: Int)

Get the child at given index.

Int

Gets the number of children.

CharSequence!

Gets the class this node comes from.

AccessibilityNodeInfoCompat.CollectionInfoCompat!

Gets the collection info if the node is a collection.

AccessibilityNodeInfoCompat.CollectionItemInfoCompat!

Gets the collection item info if the node is a collection item.

CharSequence?

Returns the container title.

CharSequence!

Gets the content description of this node.

Int

Get the drawing order of the view corresponding it this node.

CharSequence!

Gets the error text of this node.

AccessibilityNodeInfo.ExtraRenderingInfo?

Gets the extra rendering info if the node is meant to be refreshed with extra data to examine rendering related accessibility issues.

Bundle!

Gets an optional bundle with extra data.

CharSequence?

Gets the hint text of this node.

Any!

This function is deprecated.

Use unwrap instead.

Int

Gets the input type of the source as defined by InputType.

AccessibilityNodeInfoCompat!

Gets the node info for which the view represented by this info serves as a label for accessibility purposes.

AccessibilityNodeInfoCompat!

Gets the node info which serves as the label of the view represented by this info for accessibility purposes.

Int

Gets the node's live region mode.

Int

Returns the maximum text length for this node.

Long

Gets the minimum time duration between two content change events.

Int

Gets the movement granularities for traversing the text of this node.

CharSequence!

Gets the package this node comes from.

CharSequence?

Get the title of the pane represented by this node.

AccessibilityNodeInfoCompat!

Gets the parent.

AccessibilityNodeInfoCompat?
getParent(prefetchingStrategy: Int)

Gets the parent.

AccessibilityNodeInfoCompat.RangeInfoCompat!

Gets the range info if this node is a range.

CharSequence?

Gets the custom role description.

CharSequence?

Gets the state description of this node.

CharSequence!

Gets the text of this node.

Int

Gets the text selection end.

Int

Gets the text selection start.

CharSequence?

Gets the tooltip text of this node.

AccessibilityNodeInfoCompat.TouchDelegateInfoCompat?

Get the TouchDelegateInfoCompat for touch delegate behavior with the represented view.

AccessibilityNodeInfoCompat!

Gets the node after which this one is visited in accessibility traversal.

AccessibilityNodeInfoCompat!

Gets the node before which this one is visited during traversal.

String?

Gets the unique id of this node.

String!

Gets the fully qualified resource name of the source view's id.

AccessibilityWindowInfoCompat!

Gets the window to which this node belongs.

Int

Gets the id of the window from which the info comes from.

Boolean

Gets whether the node has setRequestInitialAccessibilityFocus.

Int
Boolean

Gets if the node's accessibility data is considered sensitive.

Boolean

Gets whether this node is accessibility focused.

Boolean

Gets whether this node is checkable.

Boolean

Gets whether this node is checked.

Boolean

Gets whether this node is clickable.

Boolean

Gets if the content of this node is invalid.

Boolean

Gets whether this node is context clickable.

Boolean

Gets if the node can be dismissed.

Boolean

Gets if the node is editable.

Boolean

Gets whether this node is enabled.

Boolean

Gets whether this node is focusable.

Boolean

Gets whether this node is focused.

Boolean

Gets if the node supports granular scrolling.

Boolean

Returns whether node represents a heading.

Boolean

Returns whether the node originates from a view considered important for accessibility.

Boolean

Gets whether this node is long clickable.

Boolean

Gets if the node is a multi line editable text.

Boolean

Gets whether this node is a password.

Boolean

Returns whether the node is explicitly marked as a focusable unit by a screen reader.

Boolean

Gets if the node is scrollable.

Boolean

Gets whether this node is selected.

Boolean

Returns whether the node's text represents a hint for the user to enter text.

Boolean

Returns whether node represents a text entry key that is part of a keyboard or keypad.

Boolean

Gets if the node has selectable text.

Boolean

Gets whether this node is visible to the user.

java-static AccessibilityNodeInfoCompat!

Returns a cached instance if such is available otherwise a new one.

java-static AccessibilityNodeInfoCompat!

Returns a cached instance if such is available or a new one is create.

java-static AccessibilityNodeInfoCompat!
obtain(source: View!)

Returns a cached instance if such is available otherwise a new one and sets the source.

java-static AccessibilityNodeInfoCompat!
obtain(root: View!, virtualDescendantId: Int)

Returns a cached instance if such is available otherwise a new one and sets the source.

Boolean
performAction(action: Int)

Performs an action on the node.

Boolean
performAction(action: Int, arguments: Bundle!)

Performs an action on the node.

Unit

This function is deprecated.

Accessibility Object recycling is no longer necessary or functional.

Boolean

Refreshes this info with the latest state of the view it represents.

Boolean

Removes an action that can be performed on the node.

Boolean
removeChild(child: View!)

Removes a child.

Boolean
removeChild(root: View!, virtualDescendantId: Int)

Removes a virtual child which is a descendant of the given root.

Unit
setAccessibilityDataSensitive(accessibilityDataSensitive: Boolean)

Sets whether this node's accessibility data is considered sensitive.

Unit

Sets whether this node is accessibility focused.

Unit

Set the extra data available for this node.

Unit

This function is deprecated.

Accessibility services should not care about these bounds.

Unit

Sets the node bounds in screen coordinates.

Unit

Sets the node bounds in window coordinates.

Unit
setCanOpenPopup(opensPopup: Boolean)

Sets if this node opens a popup or a dialog.

Unit
setCheckable(checkable: Boolean)

Sets whether this node is checkable.

Unit
setChecked(checked: Boolean)

Sets whether this node is checked.

Unit

Sets the class this node comes from.

Unit
setClickable(clickable: Boolean)

Sets whether this node is clickable.

Unit
setCollectionInfo(collectionInfo: Any!)
Unit
setCollectionItemInfo(collectionItemInfo: Any!)
Unit
setContainerTitle(containerTitle: CharSequence?)

Sets the container title for app-developer-defined container which can be any type of ViewGroup or layout.

Unit
setContentDescription(contentDescription: CharSequence!)

Sets the content description of this node.

Unit
setContentInvalid(contentInvalid: Boolean)

Sets if the content of this node is invalid.

Unit
setContextClickable(contextClickable: Boolean)

Sets whether this node is context clickable.

Unit
setDismissable(dismissable: Boolean)

Sets if the node can be dismissed.

Unit
setDrawingOrder(drawingOrderInParent: Int)

Set the drawing order of the view corresponding it this node.

Unit
setEditable(editable: Boolean)

Sets whether this node is editable.

Unit
setEnabled(enabled: Boolean)

Sets whether this node is enabled.

Unit

Sets the error text of this node.

Unit
setFocusable(focusable: Boolean)

Sets whether this node is focusable.

Unit
setFocused(focused: Boolean)

Sets whether this node is focused.

Unit
setGranularScrollingSupported(granularScrollingSupported: Boolean)

Sets if the node supports granular scrolling.

Unit
setHeading(isHeading: Boolean)

Sets whether the node represents a heading.

Unit

Sets the hint text of this node.

Unit

Sets whether the node is considered important for accessibility.

Unit
setInputType(inputType: Int)

Sets the input type of the source as defined by InputType.

Unit
setLabelFor(labeled: View!)

Sets the view for which the view represented by this info serves as a label for accessibility purposes.

Unit
setLabelFor(root: View!, virtualDescendantId: Int)

Sets the view for which the view represented by this info serves as a label for accessibility purposes.

Unit
setLabeledBy(label: View!)

Sets the view which serves as the label of the view represented by this info for accessibility purposes.

Unit
setLabeledBy(root: View!, virtualDescendantId: Int)

Sets the view which serves as the label of the view represented by this info for accessibility purposes.

Unit

Sets the node's live region mode.

Unit
setLongClickable(longClickable: Boolean)

Sets whether this node is long clickable.

Unit

Sets the maximum text length, or -1 for no limit.

Unit

Sets the minimum time duration between two content change events, which is used in throttling content change events in accessibility services.

Unit
setMovementGranularities(granularities: Int)

Sets the movement granularities for traversing the text of this node.

Unit
setMultiLine(multiLine: Boolean)

Sets if the node is a multi line editable text.

Unit

Sets the package this node comes from.

Unit

If this node represents a visually distinct region of the screen that may update separately from the rest of the window, it is considered a pane.

Unit
setParent(parent: View!)

Sets the parent.

Unit
setParent(root: View!, virtualDescendantId: Int)

Sets the parent to be a virtual descendant of the given root.

Unit
setPassword(password: Boolean)

Sets whether this node is a password.

Unit

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

Unit

Sets the range info if this node is a range.

Unit
setRequestInitialAccessibilityFocus(
    requestInitialAccessibilityFocus: Boolean
)

Sets whether the node has requested initial accessibility focus.

Unit
setRoleDescription(roleDescription: CharSequence?)

Sets the custom role description.

Unit
setScreenReaderFocusable(screenReaderFocusable: Boolean)

Sets whether the node should be considered a focusable unit by a screen reader.

Unit
setScrollable(scrollable: Boolean)

Sets if the node is scrollable.

Unit
setSelected(selected: Boolean)

Sets whether this node is selected.

Unit
setShowingHintText(showingHintText: Boolean)

Sets whether the node's text represents a hint for the user to enter text.

Unit
setSource(source: View!)

Sets the source.

Unit
setSource(root: View!, virtualDescendantId: Int)

Sets the source to be a virtual descendant of the given root.

Unit
setStateDescription(stateDescription: CharSequence?)

Sets the state description of this node.

Unit

Sets the text of this node.

Unit
setTextEntryKey(isTextEntryKey: Boolean)

Sets whether the node represents a text entry key that is part of a keyboard or keypad.

Unit
setTextSelectable(selectableText: Boolean)

Sets if the node has selectable text.

Unit
setTextSelection(start: Int, end: Int)

Sets the text selection start and end.

Unit

Sets the tooltip text of this node.

Unit

Set touch delegate info if the represented view has a android.view.TouchDelegate.

Unit

Sets the view whose node is visited after this one in accessibility traversal.

Unit
setTraversalAfter(root: View!, virtualDescendantId: Int)

Sets the node after which this one is visited in accessibility traversal.

Unit

Sets the view before whose node this one should be visited during traversal.

Unit
setTraversalBefore(root: View!, virtualDescendantId: Int)

Sets the node before which this one is visited during traversal.

Unit
setUniqueId(uniqueId: String?)

Sets the unique id of this node.

Unit

Sets the fully qualified resource name of the source view's id.

Unit
setVisibleToUser(visibleToUser: Boolean)

Sets whether this node is visible to the user.

String
AccessibilityNodeInfo!
java-static AccessibilityNodeInfoCompat!

Creates a new instance wrapping an android.view.accessibility.AccessibilityNodeInfo.

Constants

ACTION_ACCESSIBILITY_FOCUS

Added in 1.1.0
const val ACTION_ACCESSIBILITY_FOCUS = 64: Int

Action that gives accessibility focus to the node.

ACTION_ARGUMENT_COLUMN_INT

Added in 1.1.0
const val ACTION_ARGUMENT_COLUMN_INT = "android.view.accessibility.action.ARGUMENT_COLUMN_INT": String!

Argument for specifying the collection column to make visible on screen.

Type: intActions:

ACTION_ARGUMENT_DIRECTION_INT

Added in 1.12.0
const val ACTION_ARGUMENT_DIRECTION_INT = "androidx.core.view.accessibility.action.ARGUMENT_DIRECTION_INT": String!

Argument to represent the direction when using ACTION_SCROLL_IN_DIRECTION.

The value of this argument can be one of:

ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN

Added in 1.1.0
const val ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN = "ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN": String!

Argument for whether when moving at granularity to extend the selection or to move it otherwise.

Type: booleanActions:ACTION_NEXT_AT_MOVEMENT_GRANULARITY, ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY

ACTION_ARGUMENT_HTML_ELEMENT_STRING

Added in 1.1.0
const val ACTION_ARGUMENT_HTML_ELEMENT_STRING = "ACTION_ARGUMENT_HTML_ELEMENT_STRING": String!

Argument for which HTML element to get moving to the next/previous HTML element.

Type: StringActions:ACTION_NEXT_HTML_ELEMENT, ACTION_PREVIOUS_HTML_ELEMENT

ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT

Added in 1.1.0
const val ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT = "ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT": String!

Argument for which movement granularity to be used when traversing the node text.

Type: intActions:ACTION_NEXT_AT_MOVEMENT_GRANULARITY, ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY

ACTION_ARGUMENT_MOVE_WINDOW_X

Added in 1.1.0
const val ACTION_ARGUMENT_MOVE_WINDOW_X = "ACTION_ARGUMENT_MOVE_WINDOW_X": String!

Argument for specifying the x coordinate to which to move a window.

Type: intActions:

ACTION_ARGUMENT_MOVE_WINDOW_Y

Added in 1.1.0
const val ACTION_ARGUMENT_MOVE_WINDOW_Y = "ACTION_ARGUMENT_MOVE_WINDOW_Y": String!

Argument for specifying the y coordinate to which to move a window.

Type: intActions:

ACTION_ARGUMENT_PRESS_AND_HOLD_DURATION_MILLIS_INT

Added in 1.5.0
const val ACTION_ARGUMENT_PRESS_AND_HOLD_DURATION_MILLIS_INT = "android.view.accessibility.action.ARGUMENT_PRESS_AND_HOLD_DURATION_MILLIS_INT": String!

Argument to represent the duration in milliseconds to press and hold a node.

Type: intActions:

ACTION_ARGUMENT_PROGRESS_VALUE

Added in 1.1.0
const val ACTION_ARGUMENT_PROGRESS_VALUE = "android.view.accessibility.action.ARGUMENT_PROGRESS_VALUE": String!

Argument for specifying the progress value to set.

Type: floatActions:

ACTION_ARGUMENT_ROW_INT

Added in 1.1.0
const val ACTION_ARGUMENT_ROW_INT = "android.view.accessibility.action.ARGUMENT_ROW_INT": String!

Argument for specifying the collection row to make visible on screen.

Type: intActions:

ACTION_ARGUMENT_SCROLL_AMOUNT_FLOAT

Added in 1.12.0
const val ACTION_ARGUMENT_SCROLL_AMOUNT_FLOAT = "androidx.core.view.accessibility.action.ARGUMENT_SCROLL_AMOUNT_FLOAT": String!

Argument to represent the scroll amount as a percent of the visible area of a node, with 1.0F as the default. Values smaller than 1.0F represent a partial scroll of the node, and values larger than 1.0F represent a scroll that extends beyond the currently visible node Rect. Setting this to POSITIVE_INFINITY or to another "too large" value should scroll to the end of the node. Negative values should not be used with this argument.

This argument should be used with the following scroll actions:

Example: if a view representing a list of items implements ACTION_SCROLL_FORWARD to scroll forward by an entire screen (one "page"), then passing a value of .25F via this argument should scroll that view only by 1/4th of a screen. Passing a value of 1.50F via this argument should scroll the view by 1 1/2 screens or to end of the node if the node doesn't extend to 1 1/2 screens.

This argument should not be used with the following scroll actions, which don't cleanly conform to granular scroll semantics:

Views that support this argument should set setGranularScrollingSupported to true. Clients should use isGranularScrollingSupported to check if granular scrolling is supported.

ACTION_ARGUMENT_SELECTION_END_INT

Added in 1.1.0
const val ACTION_ARGUMENT_SELECTION_END_INT = "ACTION_ARGUMENT_SELECTION_END_INT": String!

Argument for specifying the selection end.

Type: intActions:ACTION_SET_SELECTION

ACTION_ARGUMENT_SELECTION_START_INT

Added in 1.1.0
const val ACTION_ARGUMENT_SELECTION_START_INT = "ACTION_ARGUMENT_SELECTION_START_INT": String!

Argument for specifying the selection start.

Type: intActions:ACTION_SET_SELECTION

ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE

Added in 1.1.0
const val ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE = "ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE": String!

Argument for specifying the text content to set

Type: CharSequenceActions:ACTION_SET_TEXT

See also
ACTION_SET_TEXT

ACTION_CLEAR_ACCESSIBILITY_FOCUS

Added in 1.1.0
const val ACTION_CLEAR_ACCESSIBILITY_FOCUS = 128: Int

Action that clears accessibility focus of the node.

ACTION_CLEAR_FOCUS

Added in 1.1.0
const val ACTION_CLEAR_FOCUS = 2: Int

Action that unfocuses the node.

ACTION_CLEAR_SELECTION

Added in 1.1.0
const val ACTION_CLEAR_SELECTION = 8: Int

Action that unselects the node.

ACTION_CLICK

Added in 1.1.0
const val ACTION_CLICK = 16: Int

Action that clicks on the node info.

See also
ACTION_CLICK

ACTION_COLLAPSE

Added in 1.1.0
const val ACTION_COLLAPSE = 524288: Int

Action to collapse an expandable node.

See also
ACTION_COLLAPSE

ACTION_COPY

Added in 1.1.0
const val ACTION_COPY = 16384: Int

Action to copy the current selection to the clipboard.

See also
ACTION_COPY

ACTION_CUT

Added in 1.1.0
const val ACTION_CUT = 65536: Int

Action to cut the current selection and place it to the clipboard.

See also
ACTION_CUT

ACTION_DISMISS

Added in 1.1.0
const val ACTION_DISMISS = 1048576: Int

Action to dismiss a dismissible node.

See also
ACTION_DISMISS

ACTION_EXPAND

Added in 1.1.0
const val ACTION_EXPAND = 262144: Int

Action to expand an expandable node.

See also
ACTION_EXPAND

ACTION_FOCUS

Added in 1.1.0
const val ACTION_FOCUS = 1: Int

Action that focuses the node.

See also
ACTION_FOCUS

ACTION_LONG_CLICK

Added in 1.1.0
const val ACTION_LONG_CLICK = 32: Int

Action that long clicks on the node.

ACTION_NEXT_AT_MOVEMENT_GRANULARITY

Added in 1.1.0
const val ACTION_NEXT_AT_MOVEMENT_GRANULARITY = 256: Int

Action that requests to go to the next entity in this node's text at a given movement granularity. For example, move to the next character, word, etc.

Arguments:ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT<, ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEANExample: Move to the previous character and do not extend selection.

          

  Bundle arguments = new Bundle();
  arguments.putInt(AccessibilityNodeInfo.ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT,
          AccessibilityNodeInfo.MOVEMENT_GRANULARITY_CHARACTER);
  arguments.putBoolean(AccessibilityNodeInfo.ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN,
          false);
  info.performAction(AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY, arguments);

ACTION_NEXT_HTML_ELEMENT

Added in 1.1.0
const val ACTION_NEXT_HTML_ELEMENT = 1024: Int

Action to move to the next HTML element of a given type. For example, move to the BUTTON, INPUT, TABLE, etc.

Arguments:ACTION_ARGUMENT_HTML_ELEMENT_STRINGExample:

          

  Bundle arguments = new Bundle();
  arguments.putString(AccessibilityNodeInfo.ACTION_ARGUMENT_HTML_ELEMENT_STRING, "BUTTON");
  info.performAction(AccessibilityNodeInfo.ACTION_NEXT_HTML_ELEMENT, arguments);

ACTION_PASTE

Added in 1.1.0
const val ACTION_PASTE = 32768: Int

Action to paste the current clipboard content.

See also
ACTION_PASTE

ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY

Added in 1.1.0
const val ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY = 512: Int

Action that requests to go to the previous entity in this node's text at a given movement granularity. For example, move to the next character, word, etc.

Arguments:ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT<, ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEANExample: Move to the next character and do not extend selection.

          

  Bundle arguments = new Bundle();
  arguments.putInt(AccessibilityNodeInfo.ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT,
          AccessibilityNodeInfo.MOVEMENT_GRANULARITY_CHARACTER);
  arguments.putBoolean(AccessibilityNodeInfo.ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN,
          false);
  info.performAction(AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY,
          arguments);

ACTION_PREVIOUS_HTML_ELEMENT

Added in 1.1.0
const val ACTION_PREVIOUS_HTML_ELEMENT = 2048: Int

Action to move to the previous HTML element of a given type. For example, move to the BUTTON, INPUT, TABLE, etc.

Arguments:ACTION_ARGUMENT_HTML_ELEMENT_STRINGExample:

          

  Bundle arguments = new Bundle();
  arguments.putString(AccessibilityNodeInfo.ACTION_ARGUMENT_HTML_ELEMENT_STRING, "BUTTON");
  info.performAction(AccessibilityNodeInfo.ACTION_PREVIOUS_HTML_ELEMENT, arguments);

ACTION_SCROLL_BACKWARD

Added in 1.1.0
const val ACTION_SCROLL_BACKWARD = 8192: Int

Action to scroll the node content backward.

ACTION_SCROLL_FORWARD

Added in 1.1.0
const val ACTION_SCROLL_FORWARD = 4096: Int

Action to scroll the node content forward.

ACTION_SELECT

Added in 1.1.0
const val ACTION_SELECT = 4: Int

Action that selects the node.

See also
ACTION_SELECT

ACTION_SET_SELECTION

Added in 1.1.0
const val ACTION_SET_SELECTION = 131072: Int

Action to set the selection. Performing this action with no arguments clears the selection.

Arguments:ACTION_ARGUMENT_SELECTION_START_INT, ACTION_ARGUMENT_SELECTION_END_INTExample:

          

  Bundle arguments = new Bundle();
  arguments.putInt(AccessibilityNodeInfo.ACTION_ARGUMENT_SELECTION_START_INT, 1);
  arguments.putInt(AccessibilityNodeInfo.ACTION_ARGUMENT_SELECTION_END_INT, 2);
  info.performAction(AccessibilityNodeInfo.ACTION_SET_SELECTION, arguments);

ACTION_SET_TEXT

Added in 1.1.0
const val ACTION_SET_TEXT = 2097152: Int

Action that sets the text of the node. Performing the action without argument, using null or empty CharSequence will clear the text. This action will also put the cursor at the end of text.

Arguments:ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCEExample:

          

  Bundle arguments = new Bundle();
  arguments.putCharSequence(AccessibilityNodeInfo.ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE,
      "android");
  info.performAction(AccessibilityNodeInfo.ACTION_SET_TEXT, arguments);

See also
ACTION_SET_TEXT

EXTRA_DATA_TEXT_CHARACTER_LOCATION_ARG_LENGTH

Added in 1.9.0
const val EXTRA_DATA_TEXT_CHARACTER_LOCATION_ARG_LENGTH = "android.view.accessibility.extra.DATA_TEXT_CHARACTER_LOCATION_ARG_LENGTH": String!

Integer argument specifying the end index of the requested text location data. Must be positive and no larger than EXTRA_DATA_TEXT_CHARACTER_LOCATION_ARG_LENGTH.

EXTRA_DATA_TEXT_CHARACTER_LOCATION_ARG_MAX_LENGTH

Added in 1.9.0
const val EXTRA_DATA_TEXT_CHARACTER_LOCATION_ARG_MAX_LENGTH = 20000: Int

The maximum allowed length of the requested text location data.

EXTRA_DATA_TEXT_CHARACTER_LOCATION_ARG_START_INDEX

Added in 1.9.0
const val EXTRA_DATA_TEXT_CHARACTER_LOCATION_ARG_START_INDEX = "android.view.accessibility.extra.DATA_TEXT_CHARACTER_LOCATION_ARG_START_INDEX": String!

Integer argument specifying the start index of the requested text location data. Must be valid inside the CharSequence returned by getText.

EXTRA_DATA_TEXT_CHARACTER_LOCATION_KEY

Added in 1.9.0
const val EXTRA_DATA_TEXT_CHARACTER_LOCATION_KEY = "android.view.accessibility.extra.DATA_TEXT_CHARACTER_LOCATION_KEY": String!

Key used to request and locate extra data for text character location. This key requests that an array of android.graphics.RectFs be added to the extras. This request is made with refreshWithExtraData. The arguments taken by this request are two integers: EXTRA_DATA_TEXT_CHARACTER_LOCATION_ARG_START_INDEX and EXTRA_DATA_TEXT_CHARACTER_LOCATION_ARG_LENGTH. The starting index must be valid inside the CharSequence returned by getText, and the length must be positive.

The data can be retrieved from the Bundle returned by getExtras using this string as a key for getParcelableArray. The android.graphics.RectF will be null for characters that either do not exist or are off the screen. {@see #refreshWithExtraData(String, Bundle)}

FLAG_PREFETCH_ANCESTORS

Added in 1.12.0
const val FLAG_PREFETCH_ANCESTORS = 1: Int

Prefetching strategy that prefetches the ancestors of the requested node.

Ancestors will be prefetched before siblings and descendants.

FLAG_PREFETCH_DESCENDANTS_BREADTH_FIRST

Added in 1.12.0
const val FLAG_PREFETCH_DESCENDANTS_BREADTH_FIRST = 16: Int

Prefetching strategy that prefetches the descendants of the requested node breadth-first.

This must not be combined with FLAG_PREFETCH_DESCENDANTS_HYBRID or FLAG_PREFETCH_DESCENDANTS_DEPTH_FIRST or this will trigger an IllegalArgumentException.

See also
FLAG_PREFETCH_ANCESTORS

for where to use these flags.

FLAG_PREFETCH_DESCENDANTS_DEPTH_FIRST

Added in 1.12.0
const val FLAG_PREFETCH_DESCENDANTS_DEPTH_FIRST = 8: Int

Prefetching strategy that prefetches the descendants of the requested node depth-first.

This must not be combined with FLAG_PREFETCH_DESCENDANTS_HYBRID or FLAG_PREFETCH_DESCENDANTS_BREADTH_FIRST or this will trigger an IllegalArgumentException.

See also
FLAG_PREFETCH_ANCESTORS

for where to use these flags.

FLAG_PREFETCH_DESCENDANTS_HYBRID

Added in 1.12.0
const val FLAG_PREFETCH_DESCENDANTS_HYBRID = 4: Int

Prefetching strategy that prefetches the descendants in a hybrid depth first and breadth first approach.

The children of the root node is prefetched before recursing on the children. This must not be combined with FLAG_PREFETCH_DESCENDANTS_DEPTH_FIRST or FLAG_PREFETCH_DESCENDANTS_BREADTH_FIRST or this will trigger an IllegalArgumentException.

See also
FLAG_PREFETCH_ANCESTORS

for where to use these flags.

FLAG_PREFETCH_SIBLINGS

Added in 1.12.0
const val FLAG_PREFETCH_SIBLINGS = 2: Int

Prefetching strategy that prefetches the siblings of the requested node.

To avoid disconnected trees, this flag will also prefetch the parent. Siblings will be prefetched before descendants.

See also
FLAG_PREFETCH_ANCESTORS

for where to use these flags.

FLAG_PREFETCH_UNINTERRUPTIBLE

Added in 1.12.0
const val FLAG_PREFETCH_UNINTERRUPTIBLE = 32: Int

Prefetching flag that specifies prefetching should not be interrupted by a request to retrieve a node or perform an action on a node.

See also
FLAG_PREFETCH_ANCESTORS

for where to use these flags.

FOCUS_ACCESSIBILITY

Added in 1.1.0
const val FOCUS_ACCESSIBILITY = 2: Int

The accessibility focus.

FOCUS_INPUT

Added in 1.1.0
const val FOCUS_INPUT = 1: Int

The input focus.

MAX_NUMBER_OF_PREFETCHED_NODES

Added in 1.12.0
const val MAX_NUMBER_OF_PREFETCHED_NODES = 50: Int

Maximum batch size of prefetched nodes for a request.

MOVEMENT_GRANULARITY_CHARACTER

Added in 1.1.0
const val MOVEMENT_GRANULARITY_CHARACTER = 1: Int

Movement granularity bit for traversing the text of a node by character.

MOVEMENT_GRANULARITY_LINE

Added in 1.1.0
const val MOVEMENT_GRANULARITY_LINE = 4: Int

Movement granularity bit for traversing the text of a node by line.

MOVEMENT_GRANULARITY_PAGE

Added in 1.1.0
const val MOVEMENT_GRANULARITY_PAGE = 16: Int

Movement granularity bit for traversing the text of a node by page.

MOVEMENT_GRANULARITY_PARAGRAPH

Added in 1.1.0
const val MOVEMENT_GRANULARITY_PARAGRAPH = 8: Int

Movement granularity bit for traversing the text of a node by paragraph.

MOVEMENT_GRANULARITY_WORD

Added in 1.1.0
const val MOVEMENT_GRANULARITY_WORD = 2: Int

Movement granularity bit for traversing the text of a node by word.

Public constructors

AccessibilityNodeInfoCompat

Added in 1.1.0
Deprecated in 1.1.0
AccessibilityNodeInfoCompat(info: Any!)

Creates a new instance wrapping an android.view.accessibility.AccessibilityNodeInfo.

Parameters
info: Any!

The info.

Public functions

addAction

Added in 1.1.0
fun addAction(
    action: AccessibilityNodeInfoCompat.AccessibilityActionCompat!
): Unit

Adds an action that can be performed on the node.

Note: Cannot be called from an android.accessibilityservice.AccessibilityService. This class is made immutable before being delivered to an AccessibilityService.

Throws
java.lang.IllegalStateException

If called from an AccessibilityService.

addAction

Added in 1.1.0
fun addAction(action: Int): Unit

Adds an action that can be performed on the node.

Note: Cannot be called from an android.accessibilityservice.AccessibilityService. This class is made immutable before being delivered to an AccessibilityService.

Parameters
action: Int

The action.

Throws
java.lang.IllegalStateException

If called from an AccessibilityService.

addChild

Added in 1.1.0
fun addChild(child: View!): Unit

Adds a child.

Note: Cannot be called from an android.accessibilityservice.AccessibilityService. This class is made immutable before being delivered to an AccessibilityService.

Parameters
child: View!

The child.

Throws
java.lang.IllegalStateException

If called from an AccessibilityService.

addChild

Added in 1.1.0
fun addChild(root: View!, virtualDescendantId: Int): Unit

Adds a virtual child which is a descendant of the given root. If virtualDescendantId is NO_ID the root is added as a child.

A virtual descendant is an imaginary View that is reported as a part of the view hierarchy for accessibility purposes. This enables custom views that draw complex content to report them selves as a tree of virtual views, thus conveying their logical structure.

Parameters
root: View!

The root of the virtual subtree.

virtualDescendantId: Int

The id of the virtual child.

canOpenPopup

Added in 1.1.0
fun canOpenPopup(): Boolean

Gets if this node opens a popup or a dialog.

Returns
Boolean

If the the node opens a popup.

equals

fun equals(obj: Any!): Boolean

findAccessibilityNodeInfosByText

Added in 1.1.0
fun findAccessibilityNodeInfosByText(text: String!): (Mutable)List<AccessibilityNodeInfoCompat!>!

Finds android.view.accessibility.AccessibilityNodeInfos by text. The match is case insensitive containment. The search is relative to this info i.e. this info is the root of the traversed tree.

Parameters
text: String!

The searched text.

Returns
(Mutable)List<AccessibilityNodeInfoCompat!>!

A list of node info.

findAccessibilityNodeInfosByViewId

Added in 1.1.0
fun findAccessibilityNodeInfosByViewId(viewId: String!): (Mutable)List<AccessibilityNodeInfoCompat!>!

Finds AccessibilityNodeInfoCompats by the fully qualified view id's resource name where a fully qualified id is of the from "package:id/id_resource_name". For example, if the target application's package is "foo.bar" and the id resource name is "baz", the fully qualified resource id is "foo.bar:id/baz".

Note: The primary usage of this API is for UI test automation and in order to report the fully qualified view id if an AccessibilityNodeInfoCompat the client has to set the FLAG_REPORT_VIEW_IDS flag when configuring their android.accessibilityservice.AccessibilityService.

Parameters
viewId: String!

The fully qualified resource name of the view id to find.

Returns
(Mutable)List<AccessibilityNodeInfoCompat!>!

A list of node info.

findFocus

Added in 1.1.0
fun findFocus(focus: Int): AccessibilityNodeInfoCompat!

Find the view that has the specified focus type. The search starts from the view represented by this node info.

Parameters
focus: Int

The focus to find. One of FOCUS_INPUT or FOCUS_ACCESSIBILITY.

Returns
AccessibilityNodeInfoCompat!

The node info of the focused view or null.

focusSearch

Added in 1.1.0
fun focusSearch(direction: Int): AccessibilityNodeInfoCompat!

Searches for the nearest view in the specified direction that can take input focus.

Parameters
direction: Int

The direction. Can be one of: FOCUS_DOWN, FOCUS_UP, FOCUS_LEFT, FOCUS_RIGHT, FOCUS_FORWARD, FOCUS_BACKWARD.

Returns
AccessibilityNodeInfoCompat!

The node info for the view that can take accessibility focus.

getActionList

Added in 1.1.0
fun getActionList(): (Mutable)List<AccessibilityNodeInfoCompat.AccessibilityActionCompat!>!

Gets the actions that can be performed on the node.

Returns
(Mutable)List<AccessibilityNodeInfoCompat.AccessibilityActionCompat!>!

A list of AccessibilityActions.

getActions

Added in 1.1.0
Deprecated in 1.9.0
fun getActions(): Int

Gets the actions that can be performed on the node.

Returns
Int

The bit mask of with actions.

getAvailableExtraData

Added in 1.8.0
fun getAvailableExtraData(): (Mutable)List<String!>

Get the extra data available for this node.

Some data that is useful for some accessibility services is expensive to compute, and would place undue overhead on apps to compute all the time. That data can be requested with refreshWithExtraData.

Returns
(Mutable)List<String!>

An unmodifiable list of keys corresponding to extra data that can be requested.

getBoundsInParent

Added in 1.1.0
Deprecated in 1.2.0
fun getBoundsInParent(outBounds: Rect!): Unit

Gets the node bounds in the viewParent's coordinates. getParent does not represent the source's viewParent. Instead it represents the result of getParentForAccessibility, which returns the closest ancestor where isImportantForAccessibility is true. So this method is not reliable.

Parameters
outBounds: Rect!

The output node bounds.

getBoundsInScreen

Added in 1.1.0
fun getBoundsInScreen(outBounds: Rect!): Unit

Gets the node bounds in screen coordinates.

Parameters
outBounds: Rect!

The output node bounds.

getBoundsInWindow

Added in 1.12.0
fun getBoundsInWindow(outBounds: Rect): Unit

Gets the node bounds in window coordinates.

When magnification is enabled, the bounds in window are scaled up by magnification scale and the positions are also adjusted according to the offset of magnification viewport. For example, it returns Rect(-180, -180, 0, 0) for original bounds Rect(10, 10, 100, 100), when the magnification scale is 2 and offsets for X and Y are both 200.

Compatibility:

  • API <19: No-op
Parameters
outBounds: Rect

The output node bounds.

getChild

Added in 1.1.0
fun getChild(index: Int): AccessibilityNodeInfoCompat!

Get the child at given index.

Parameters
index: Int

The child index.

Returns
AccessibilityNodeInfoCompat!

The child node.

Throws
java.lang.IllegalStateException

If called outside of an AccessibilityService.

getChild

Added in 1.12.0
fun getChild(index: Int, prefetchingStrategy: Int): AccessibilityNodeInfoCompat?

Get the child at given index.

Parameters
index: Int

The child index.

prefetchingStrategy: Int

the prefetching strategy.

Returns
AccessibilityNodeInfoCompat?

The child node.

Throws
java.lang.IllegalStateException

If called outside of an AccessibilityService and before calling setQueryFromAppProcessEnabled.

See also
getParent

for a description of prefetching.

getChildCount

Added in 1.1.0
fun getChildCount(): Int

Gets the number of children.

Returns
Int

The child count.

getClassName

Added in 1.1.0
fun getClassName(): CharSequence!

Gets the class this node comes from.

Returns
CharSequence!

The class name.

getCollectionInfo

Added in 1.1.0
fun getCollectionInfo(): AccessibilityNodeInfoCompat.CollectionInfoCompat!

Gets the collection info if the node is a collection. A collection child is always a collection item.

Returns
AccessibilityNodeInfoCompat.CollectionInfoCompat!

The collection info.

getCollectionItemInfo

Added in 1.1.0
fun getCollectionItemInfo(): AccessibilityNodeInfoCompat.CollectionItemInfoCompat!

Gets the collection item info if the node is a collection item. A collection item is always a child of a collection.

Returns
AccessibilityNodeInfoCompat.CollectionItemInfoCompat!

The collection item info.

getContainerTitle

Added in 1.12.0
fun getContainerTitle(): CharSequence?

Returns the container title.

Compatibility:

  • API <19: Returns null
See also
setContainerTitle

for details.

getContentDescription

Added in 1.1.0
fun getContentDescription(): CharSequence!

Gets the content description of this node.

Returns
CharSequence!

The content description.

getDrawingOrder

Added in 1.1.0
fun getDrawingOrder(): Int

Get the drawing order of the view corresponding it this node.

Drawing order is determined only within the node's parent, so this index is only relative to its siblings.

In some cases, the drawing order is essentially simultaneous, so it is possible for two siblings to return the same value. It is also possible that values will be skipped.

Returns
Int

The drawing position of the view corresponding to this node relative to its siblings.

getError

Added in 1.1.0
fun getError(): CharSequence!

Gets the error text of this node.

Returns
CharSequence!

The error text.

getExtraRenderingInfo

Added in 1.9.0
fun getExtraRenderingInfo(): AccessibilityNodeInfo.ExtraRenderingInfo?

Gets the extra rendering info if the node is meant to be refreshed with extra data to examine rendering related accessibility issues.

getExtras

Added in 1.1.0
fun getExtras(): Bundle!

Gets an optional bundle with extra data. The bundle is lazily created and never null.

Note: It is recommended to use the package name of your application as a prefix for the keys to avoid collisions which may confuse an accessibility service if the same key has different meaning when emitted from different applications.

Returns
Bundle!

The bundle.

getHintText

Added in 1.1.0
fun getHintText(): CharSequence?

Gets the hint text of this node. Only applies to nodes where text can be entered.

Returns
CharSequence?

The hint text.

getInfo

Added in 1.1.0
Deprecated in 1.1.0
fun getInfo(): Any!

getInputType

Added in 1.1.0
fun getInputType(): Int

Gets the input type of the source as defined by InputType.

Returns
Int

The input type.

getLabelFor

Added in 1.1.0
fun getLabelFor(): AccessibilityNodeInfoCompat!

Gets the node info for which the view represented by this info serves as a label for accessibility purposes.

Returns
AccessibilityNodeInfoCompat!

The labeled info.

getLabeledBy

Added in 1.1.0
fun getLabeledBy(): AccessibilityNodeInfoCompat!

Gets the node info which serves as the label of the view represented by this info for accessibility purposes.

Returns
AccessibilityNodeInfoCompat!

The label.

getLiveRegion

Added in 1.1.0
fun getLiveRegion(): Int

Gets the node's live region mode.

A live region is a node that contains information that is important for the user and when it changes the user should be notified. For example, in a login screen with a TextView that displays an "incorrect password" notification, that view should be marked as a live region with mode ACCESSIBILITY_LIVE_REGION_POLITE.

It is the responsibility of the accessibility service to monitor TYPE_WINDOW_CONTENT_CHANGED events indicating changes to live region nodes and their children.

Returns
Int

The live region mode, or ACCESSIBILITY_LIVE_REGION_NONE if the view is not a live region.

getMaxTextLength

Added in 1.1.0
fun getMaxTextLength(): Int

Returns the maximum text length for this node.

Returns
Int

The maximum text length, or -1 for no limit.

See also
setMaxTextLength

getMinDurationBetweenContentChangesMillis

Added in 1.10.0
fun getMinDurationBetweenContentChangesMillis(): Long

Gets the minimum time duration between two content change events.

getMovementGranularities

Added in 1.1.0
fun getMovementGranularities(): Int

Gets the movement granularities for traversing the text of this node.

Returns
Int

The bit mask with granularities.

getPackageName

Added in 1.1.0
fun getPackageName(): CharSequence!

Gets the package this node comes from.

Returns
CharSequence!

The package name.

getPaneTitle

Added in 1.1.0
fun getPaneTitle(): CharSequence?

Get the title of the pane represented by this node.

Returns
CharSequence?

The title of the pane represented by this node, or null if this node does not represent a pane.

getParent

Added in 1.1.0
fun getParent(): AccessibilityNodeInfoCompat!

Gets the parent.

Returns
AccessibilityNodeInfoCompat!

The parent.

getParent

Added in 1.12.0
fun getParent(prefetchingStrategy: Int): AccessibilityNodeInfoCompat?

Gets the parent.

Use prefetchingStrategy to determine the types of nodes prefetched from the app if the requested node is not in the cache and must be retrieved by the app. The default strategy for getParent is a combination of ancestor and sibling strategies. The app will prefetch until all nodes fulfilling the strategies are fetched, another node request is sent, or the maximum prefetch batch size of MAX_NUMBER_OF_PREFETCHED_NODES nodes is reached. To prevent interruption by another request and to force prefetching of the max batch size, use FLAG_PREFETCH_UNINTERRUPTIBLE.

Parameters
prefetchingStrategy: Int

the prefetching strategy.

Returns
AccessibilityNodeInfoCompat?

The parent.

Throws
java.lang.IllegalStateException

If called outside of an AccessibilityService and before calling setQueryFromAppProcessEnabled.

getRangeInfo

Added in 1.1.0
fun getRangeInfo(): AccessibilityNodeInfoCompat.RangeInfoCompat!

Gets the range info if this node is a range.

getRoleDescription

Added in 1.1.0
fun getRoleDescription(): CharSequence?

Gets the custom role description.

Returns
CharSequence?

The role description.

getStateDescription

Added in 1.5.0
fun getStateDescription(): CharSequence?

Gets the state description of this node.

Returns
CharSequence?

the state description or null if android version smaller than 19.

getText

Added in 1.1.0
fun getText(): CharSequence!

Gets the text of this node.

Returns
CharSequence!

The text.

getTextSelectionEnd

Added in 1.1.0
fun getTextSelectionEnd(): Int

Gets the text selection end.

Returns
Int

The text selection end if there is selection or -1.

getTextSelectionStart

Added in 1.1.0
fun getTextSelectionStart(): Int

Gets the text selection start.

Returns
Int

The text selection start if there is selection or -1.

getTooltipText

Added in 1.1.0
fun getTooltipText(): CharSequence?

Gets the tooltip text of this node.

Returns
CharSequence?

The tooltip text.

getTouchDelegateInfo

Added in 1.2.0
fun getTouchDelegateInfo(): AccessibilityNodeInfoCompat.TouchDelegateInfoCompat?

Get the TouchDelegateInfoCompat for touch delegate behavior with the represented view. It is possible for the same node to be pointed to by several regions. Use getRegionAt to get touch delegate target Region, and getTargetForRegion for AccessibilityNodeInfoCompat from the given region.

Compatibility:

  • API <29: Always returns null
Returns
AccessibilityNodeInfoCompat.TouchDelegateInfoCompat?

TouchDelegateInfoCompat or null if there are no touch delegates in this node.

getTraversalAfter

Added in 1.1.0
fun getTraversalAfter(): AccessibilityNodeInfoCompat!

Gets the node after which this one is visited in accessibility traversal. A screen-reader must visit the content of the other node before the content of this one.

Returns
AccessibilityNodeInfoCompat!

The succeeding node if such or null.

getTraversalBefore

Added in 1.1.0
fun getTraversalBefore(): AccessibilityNodeInfoCompat!

Gets the node before which this one is visited during traversal. A screen-reader must visit the content of this node before the content of the one it precedes.

Returns
AccessibilityNodeInfoCompat!

The succeeding node if such or null.

getUniqueId

Added in 1.9.0
fun getUniqueId(): String?

Gets the unique id of this node.

Returns
String?

the unique id or null if android version smaller than 19.

getViewIdResourceName

Added in 1.1.0
fun getViewIdResourceName(): String!

Gets the fully qualified resource name of the source view's id.

Note: The primary usage of this API is for UI test automation and in order to report the source view id of an AccessibilityNodeInfoCompat the client has to set the FLAG_REPORT_VIEW_IDS flag when configuring their android.accessibilityservice.AccessibilityService.

Returns
String!

The id resource name.

getWindow

Added in 1.1.0
fun getWindow(): AccessibilityWindowInfoCompat!

Gets the window to which this node belongs.

Returns
AccessibilityWindowInfoCompat!

The window.

See also
getWindows

getWindowId

Added in 1.1.0
fun getWindowId(): Int

Gets the id of the window from which the info comes from.

Returns
Int

The window id.

hasRequestInitialAccessibilityFocus

Added in 1.10.0
fun hasRequestInitialAccessibilityFocus(): Boolean

Gets whether the node has setRequestInitialAccessibilityFocus.

Returns
Boolean

True if the node has requested initial accessibility focus.

hashCode

fun hashCode(): Int

isAccessibilityDataSensitive

Added in 1.12.0
fun isAccessibilityDataSensitive(): Boolean

Gets if the node's accessibility data is considered sensitive.

Returns
Boolean

True if the node's data is considered sensitive, false otherwise.

isAccessibilityFocused

Added in 1.1.0
fun isAccessibilityFocused(): Boolean

Gets whether this node is accessibility focused.

Returns
Boolean

True if the node is accessibility focused.

isCheckable

Added in 1.1.0
fun isCheckable(): Boolean

Gets whether this node is checkable.

Returns
Boolean

True if the node is checkable.

isChecked

Added in 1.1.0
fun isChecked(): Boolean

Gets whether this node is checked.

Returns
Boolean

True if the node is checked.

isClickable

Added in 1.1.0
fun isClickable(): Boolean

Gets whether this node is clickable.

Returns
Boolean

True if the node is clickable.

isContentInvalid

Added in 1.1.0
fun isContentInvalid(): Boolean

Gets if the content of this node is invalid. For example, a date is not well-formed.

Returns
Boolean

If the node content is invalid.

isContextClickable

Added in 1.1.0
fun isContextClickable(): Boolean

Gets whether this node is context clickable.

Returns
Boolean

True if the node is context clickable.

isDismissable

Added in 1.1.0
fun isDismissable(): Boolean

Gets if the node can be dismissed.

Returns
Boolean

If the node can be dismissed.

isEditable

Added in 1.1.0
fun isEditable(): Boolean

Gets if the node is editable.

Returns
Boolean

True if the node is editable, false otherwise.

isEnabled

Added in 1.1.0
fun isEnabled(): Boolean

Gets whether this node is enabled.

Returns
Boolean

True if the node is enabled.

isFocusable

Added in 1.1.0
fun isFocusable(): Boolean

Gets whether this node is focusable.

Returns
Boolean

True if the node is focusable.

isFocused

Added in 1.1.0
fun isFocused(): Boolean

Gets whether this node is focused.

Returns
Boolean

True if the node is focused.

isGranularScrollingSupported

Added in 1.12.0
fun isGranularScrollingSupported(): Boolean

Gets if the node supports granular scrolling.

Compatibility:

  • Api <19: Returns false.
Returns
Boolean

True if all scroll actions that could support ACTION_ARGUMENT_SCROLL_AMOUNT_FLOAT have done so, false otherwise.

isHeading

Added in 1.1.0
fun isHeading(): Boolean

Returns whether node represents a heading.

Note: Returns true if either setHeading marks this node as a heading or if the node has a CollectionItemInfoCompat that marks it as such, to accommodate apps that use the now-deprecated API.

Returns
Boolean

true if the node is a heading, false otherwise.

isImportantForAccessibility

Added in 1.1.0
fun isImportantForAccessibility(): Boolean

Returns whether the node originates from a view considered important for accessibility.

Returns
Boolean

true if the node originates from a view considered important for accessibility, false otherwise

isLongClickable

Added in 1.1.0
fun isLongClickable(): Boolean

Gets whether this node is long clickable.

Returns
Boolean

True if the node is long clickable.

isMultiLine

Added in 1.1.0
fun isMultiLine(): Boolean

Gets if the node is a multi line editable text.

Returns
Boolean

True if the node is multi line.

isPassword

Added in 1.1.0
fun isPassword(): Boolean

Gets whether this node is a password.

Returns
Boolean

True if the node is a password.

isScreenReaderFocusable

Added in 1.1.0
fun isScreenReaderFocusable(): Boolean

Returns whether the node is explicitly marked as a focusable unit by a screen reader. Note that false indicates that it is not explicitly marked, not that the node is not a focusable unit. Screen readers should generally use other signals, such as isFocusable, or the presence of text in a node, to determine what should receive focus.

Returns
Boolean

true if the node is specifically marked as a focusable unit for screen readers, false otherwise.

isScrollable

Added in 1.1.0
fun isScrollable(): Boolean

Gets if the node is scrollable.

Returns
Boolean

True if the node is scrollable, false otherwise.

isSelected

Added in 1.1.0
fun isSelected(): Boolean

Gets whether this node is selected.

Returns
Boolean

True if the node is selected.

isShowingHintText

Added in 1.1.0
fun isShowingHintText(): Boolean

Returns whether the node's text represents a hint for the user to enter text. It should only be true if the node has editable text.

Returns
Boolean

true if the text in the node represents a hint to the user, false otherwise.

isTextEntryKey

Added in 1.1.0
fun isTextEntryKey(): Boolean

Returns whether node represents a text entry key that is part of a keyboard or keypad.

Returns
Boolean

true if the node is a text entry key, false otherwise.

isTextSelectable

Added in 1.9.0
fun isTextSelectable(): Boolean

Gets if the node has selectable text.

Services should use ACTION_SET_SELECTION for selection. Editable text nodes must also be selectable. But not all UIs will populate this field, so services should consider 'isTextSelectable | isEditable' to ensure they don't miss nodes with selectable text.

Compatibility:

  • Api <19: Returns false.
Returns
Boolean

True if the node has selectable text.

See also
isEditable

isVisibleToUser

Added in 1.1.0
fun isVisibleToUser(): Boolean

Gets whether this node is visible to the user.

Returns
Boolean

Whether the node is visible to the user.

obtain

Added in 1.1.0
java-static fun obtain(): AccessibilityNodeInfoCompat!

Returns a cached instance if such is available otherwise a new one.

Returns
AccessibilityNodeInfoCompat!

An instance.

obtain

Added in 1.1.0
java-static fun obtain(info: AccessibilityNodeInfoCompat!): AccessibilityNodeInfoCompat!

Returns a cached instance if such is available or a new one is create. The returned instance is initialized from the given info.

Parameters
info: AccessibilityNodeInfoCompat!

The other info.

Returns
AccessibilityNodeInfoCompat!

An instance.

obtain

Added in 1.1.0
java-static fun obtain(source: View!): AccessibilityNodeInfoCompat!

Returns a cached instance if such is available otherwise a new one and sets the source.

Returns
AccessibilityNodeInfoCompat!

An instance.

See also
setSource

obtain

Added in 1.1.0
java-static fun obtain(root: View!, virtualDescendantId: Int): AccessibilityNodeInfoCompat!

Returns a cached instance if such is available otherwise a new one and sets the source.

Parameters
root: View!

The root of the virtual subtree.

virtualDescendantId: Int

The id of the virtual descendant.

Returns
AccessibilityNodeInfoCompat!

An instance.

See also
setSource

performAction

Added in 1.1.0
fun performAction(action: Int): Boolean

Performs an action on the node.

Note: An action can be performed only if the request is made from an android.accessibilityservice.AccessibilityService.

Parameters
action: Int

The action to perform.

Returns
Boolean

True if the action was performed.

Throws
java.lang.IllegalStateException

If called outside of an AccessibilityService.

performAction

Added in 1.1.0
fun performAction(action: Int, arguments: Bundle!): Boolean

Performs an action on the node.

Note: An action can be performed only if the request is made from an android.accessibilityservice.AccessibilityService.

Parameters
action: Int

The action to perform.

arguments: Bundle!

A bundle with additional arguments.

Returns
Boolean

True if the action was performed.

Throws
java.lang.IllegalStateException

If called outside of an AccessibilityService.

recycle

Added in 1.1.0
Deprecated in 1.10.0
fun recycle(): Unit

Return an instance back to be reused.

Note: You must not touch the object after calling this function.

Throws
java.lang.IllegalStateException

If the info is already recycled.

refresh

Added in 1.1.0
fun refresh(): Boolean

Refreshes this info with the latest state of the view it represents.

Note: If this method returns false this info is obsolete since it represents a view that is no longer in the view tree.

Returns
Boolean

Whether the refresh succeeded.

removeAction

Added in 1.1.0
fun removeAction(
    action: AccessibilityNodeInfoCompat.AccessibilityActionCompat!
): Boolean

Removes an action that can be performed on the node. If the action was not already added to the node, calling this method has no effect.

Note: Cannot be called from an android.accessibilityservice.AccessibilityService. This class is made immutable before being delivered to an AccessibilityService.

Parameters
action: AccessibilityNodeInfoCompat.AccessibilityActionCompat!

The action to be removed.

Returns
Boolean

The action removed from the list of actions.

Throws
java.lang.IllegalStateException

If called from an AccessibilityService.

removeChild

Added in 1.1.0
fun removeChild(child: View!): Boolean

Removes a child. If the child was not previously added to the node, calling this method has no effect.

Note: Cannot be called from an android.accessibilityservice.AccessibilityService. This class is made immutable before being delivered to an AccessibilityService.

Parameters
child: View!

The child.

Returns
Boolean

true if the child was present

Throws
java.lang.IllegalStateException

If called from an AccessibilityService.

removeChild

Added in 1.1.0
fun removeChild(root: View!, virtualDescendantId: Int): Boolean

Removes a virtual child which is a descendant of the given root. If the child was not previously added to the node, calling this method has no effect.

Parameters
root: View!

The root of the virtual subtree.

virtualDescendantId: Int

The id of the virtual child.

Returns
Boolean

true if the child was present

See also
addChild

setAccessibilityDataSensitive

Added in 1.12.0
fun setAccessibilityDataSensitive(accessibilityDataSensitive: Boolean): Unit

Sets whether this node's accessibility data is considered sensitive.

For SDK 34 and higher: when set to true the framework will hide this node from accessibility services with the isAccessibilityTool property set to false.

Otherwise, for SDK 19 and higher: the framework cannot hide this node but this property may be read by accessibility services to provide modified behavior for sensitive nodes.

Note: Cannot be called from an android.accessibilityservice.AccessibilityService. This class is made immutable before being delivered to an AccessibilityService.

Parameters
accessibilityDataSensitive: Boolean

True if the node's accessibility data is considered sensitive.

Throws
java.lang.IllegalStateException

If called from an AccessibilityService.

setAccessibilityFocused

Added in 1.1.0
fun setAccessibilityFocused(focused: Boolean): Unit

Sets whether this node is accessibility focused.

Note: Cannot be called from an android.accessibilityservice.AccessibilityService. This class is made immutable before being delivered to an AccessibilityService.

Parameters
focused: Boolean

True if the node is accessibility focused.

Throws
java.lang.IllegalStateException

If called from an AccessibilityService.

setAvailableExtraData

Added in 1.8.0
fun setAvailableExtraData(extraDataKeys: (Mutable)List<String!>): Unit

Set the extra data available for this node.

Note: When a View passes in a non-empty list, it promises that it will populate the node's extras with corresponding pieces of information in addExtraDataToAccessibilityNodeInfo.

Note: Cannot be called from an android.accessibilityservice.AccessibilityService. This class is made immutable before being delivered to an AccessibilityService.

Parameters
extraDataKeys: (Mutable)List<String!>

A list of types of extra data that are available.

Throws
java.lang.IllegalStateException

If called from an AccessibilityService.

setBoundsInParent

Added in 1.1.0
Deprecated in 1.2.0
fun setBoundsInParent(bounds: Rect!): Unit

Sets the node bounds in the viewParent's coordinates. getParent does not represent the source's viewParent. Instead it represents the result of getParentForAccessibility, which returns the closest ancestor where isImportantForAccessibility is true. So this method is not reliable.

Note: Cannot be called from an android.accessibilityservice.AccessibilityService. This class is made immutable before being delivered to an AccessibilityService.

Parameters
bounds: Rect!

The node bounds.

Throws
java.lang.IllegalStateException

If called from an AccessibilityService.

setBoundsInScreen

Added in 1.1.0
fun setBoundsInScreen(bounds: Rect!): Unit

Sets the node bounds in screen coordinates.

Note: Cannot be called from an android.accessibilityservice.AccessibilityService. This class is made immutable before being delivered to an AccessibilityService.

Parameters
bounds: Rect!

The node bounds.

Throws
java.lang.IllegalStateException

If called from an AccessibilityService.

setBoundsInWindow

Added in 1.12.0
fun setBoundsInWindow(bounds: Rect): Unit

Sets the node bounds in window coordinates.

Note: Cannot be called from an android.accessibilityservice.AccessibilityService. This class is made immutable before being delivered to an AccessibilityService.

Compatibility:

  • API <19: No-op
Parameters
bounds: Rect

The node bounds.

Throws
java.lang.IllegalStateException

If called from an AccessibilityService.

setCanOpenPopup

Added in 1.1.0
fun setCanOpenPopup(opensPopup: Boolean): Unit

Sets if this node opens a popup or a dialog.

Note: Cannot be called from an android.accessibilityservice.AccessibilityService. This class is made immutable before being delivered to an AccessibilityService.

Parameters
opensPopup: Boolean

If the the node opens a popup.

setCheckable

Added in 1.1.0
fun setCheckable(checkable: Boolean): Unit

Sets whether this node is checkable.

Note: Cannot be called from an android.accessibilityservice.AccessibilityService. This class is made immutable before being delivered to an AccessibilityService.

Parameters
checkable: Boolean

True if the node is checkable.

Throws
java.lang.IllegalStateException

If called from an AccessibilityService.

setChecked

Added in 1.1.0
fun setChecked(checked: Boolean): Unit

Sets whether this node is checked.

Note: Cannot be called from an android.accessibilityservice.AccessibilityService. This class is made immutable before being delivered to an AccessibilityService.

Parameters
checked: Boolean

True if the node is checked.

Throws
java.lang.IllegalStateException

If called from an AccessibilityService.

setClassName

Added in 1.1.0
fun setClassName(className: CharSequence!): Unit

Sets the class this node comes from.

Note: Cannot be called from an android.accessibilityservice.AccessibilityService. This class is made immutable before being delivered to an AccessibilityService.

Parameters
className: CharSequence!

The class name.

Throws
java.lang.IllegalStateException

If called from an AccessibilityService.

setClickable

Added in 1.1.0
fun setClickable(clickable: Boolean): Unit

Sets whether this node is clickable.

Note: Cannot be called from an android.accessibilityservice.AccessibilityService. This class is made immutable before being delivered to an AccessibilityService.

Parameters
clickable: Boolean

True if the node is clickable.

Throws
java.lang.IllegalStateException

If called from an AccessibilityService.

setCollectionInfo

Added in 1.1.0
fun setCollectionInfo(collectionInfo: Any!): Unit

setCollectionItemInfo

Added in 1.1.0
fun setCollectionItemInfo(collectionItemInfo: Any!): Unit

setContainerTitle

Added in 1.12.0
fun setContainerTitle(containerTitle: CharSequence?): Unit

Sets the container title for app-developer-defined container which can be any type of ViewGroup or layout. Container title will be used to group together related controls, similar to HTML fieldset. Or container title may identify a large piece of the UI that is visibly grouped together, such as a toolbar or a card, etc.

Container title helps to assist in navigation across containers and other groups. For example, a screen reader may use this to determine where to put accessibility focus.

Container title is different from pane titlesetPaneTitle which indicates that the node represents a window or activity.

Example: An app can set container titles on several non-modal menus, containing TextViews or ImageButtons that have content descriptions, text, etc. Screen readers can quickly switch accessibility focus among menus instead of child views. Other accessibility-services can easily find the menu.

Compatibility:

  • API <19: No-op
Parameters
containerTitle: CharSequence?

The container title that is associated with a ViewGroup/Layout on the screen.

setContentDescription

Added in 1.1.0
fun setContentDescription(contentDescription: CharSequence!): Unit

Sets the content description of this node.

Note: Cannot be called from an android.accessibilityservice.AccessibilityService. This class is made immutable before being delivered to an AccessibilityService.

Parameters
contentDescription: CharSequence!

The content description.

Throws
java.lang.IllegalStateException

If called from an AccessibilityService.

setContentInvalid

Added in 1.1.0
fun setContentInvalid(contentInvalid: Boolean): Unit

Sets if the content of this node is invalid. For example, a date is not well-formed.

Note: Cannot be called from an android.accessibilityservice.AccessibilityService. This class is made immutable before being delivered to an AccessibilityService.

Parameters
contentInvalid: Boolean

If the node content is invalid.

setContextClickable

Added in 1.1.0
fun setContextClickable(contextClickable: Boolean): Unit

Sets whether this node is context clickable.

Note: Cannot be called from an android.accessibilityservice.AccessibilityService. This class is made immutable before being delivered to an AccessibilityService.

Parameters
contextClickable: Boolean

True if the node is context clickable.

Throws
java.lang.IllegalStateException

If called from an AccessibilityService.

setDismissable

Added in 1.1.0
fun setDismissable(dismissable: Boolean): Unit

Sets if the node can be dismissed.

Note: Cannot be called from an android.accessibilityservice.AccessibilityService. This class is made immutable before being delivered to an AccessibilityService.

Parameters
dismissable: Boolean

If the node can be dismissed.

setDrawingOrder

Added in 1.1.0
fun setDrawingOrder(drawingOrderInParent: Int): Unit

Set the drawing order of the view corresponding it this node.

Note: Cannot be called from an android.accessibilityservice.AccessibilityService. This class is made immutable before being delivered to an AccessibilityService.

Parameters
drawingOrderInParent: Int
Throws
java.lang.IllegalStateException

If called from an AccessibilityService.

setEditable

Added in 1.1.0
fun setEditable(editable: Boolean): Unit

Sets whether this node is editable.

Note: Cannot be called from an android.accessibilityservice.AccessibilityService. This class is made immutable before being delivered to an AccessibilityService.

Parameters
editable: Boolean

True if the node is editable.

Throws
java.lang.IllegalStateException

If called from an AccessibilityService.

setEnabled

Added in 1.1.0
fun setEnabled(enabled: Boolean): Unit

Sets whether this node is enabled.

Note: Cannot be called from an android.accessibilityservice.AccessibilityService. This class is made immutable before being delivered to an AccessibilityService.

Parameters
enabled: Boolean

True if the node is enabled.

Throws
java.lang.IllegalStateException

If called from an AccessibilityService.

setError

Added in 1.1.0
fun setError(error: CharSequence!): Unit

Sets the error text of this node.

Note: Cannot be called from an android.accessibilityservice.AccessibilityService. This class is made immutable before being delivered to an AccessibilityService.

Parameters
error: CharSequence!

The error text.

Throws
java.lang.IllegalStateException

If called from an AccessibilityService.

setFocusable

Added in 1.1.0
fun setFocusable(focusable: Boolean): Unit

Sets whether this node is focusable.

Note: Cannot be called from an android.accessibilityservice.AccessibilityService. This class is made immutable before being delivered to an AccessibilityService.

Parameters
focusable: Boolean

True if the node is focusable.

Throws
java.lang.IllegalStateException

If called from an AccessibilityService.

setFocused

Added in 1.1.0
fun setFocused(focused: Boolean): Unit

Sets whether this node is focused.

Note: Cannot be called from an android.accessibilityservice.AccessibilityService. This class is made immutable before being delivered to an AccessibilityService.

Parameters
focused: Boolean

True if the node is focused.

Throws
java.lang.IllegalStateException

If called from an AccessibilityService.

setGranularScrollingSupported

Added in 1.12.0
fun setGranularScrollingSupported(granularScrollingSupported: Boolean): Unit

Sets if the node supports granular scrolling. This should be set to true if all scroll actions which could support ACTION_ARGUMENT_SCROLL_AMOUNT_FLOAT have done so.

Note: Cannot be called from an android.accessibilityservice.AccessibilityService. This class is made immutable before being delivered to an AccessibilityService.

Compatibility:

  • Api <19: No-op.
Parameters
granularScrollingSupported: Boolean

True if the node supports granular scrolling, false otherwise.

Throws
java.lang.IllegalStateException

If called from an AccessibilityService.

setHeading

Added in 1.1.0
fun setHeading(isHeading: Boolean): Unit

Sets whether the node represents a heading.

This method has no effect below API 19

Note: Cannot be called from an android.accessibilityservice.AccessibilityService. This class is made immutable before being delivered to an AccessibilityService.

Parameters
isHeading: Boolean

true if the node is a heading, false otherwise.

setHintText

Added in 1.1.0
fun setHintText(hintText: CharSequence?): Unit

Sets the hint text of this node. Only applies to nodes where text can be entered.

This method has no effect below API 19

Note: Cannot be called from an android.accessibilityservice.AccessibilityService. This class is made immutable before being delivered to an AccessibilityService.

Parameters
hintText: CharSequence?

The hint text for this mode.

Throws
java.lang.IllegalStateException

If called from an AccessibilityService.

setImportantForAccessibility

Added in 1.1.0
fun setImportantForAccessibility(important: Boolean): Unit

Sets whether the node is considered important for accessibility.

Note: Cannot be called from an android.accessibilityservice.AccessibilityService. This class is made immutable before being delivered to an AccessibilityService.

Parameters
important: Boolean

true if the node is considered important for accessibility, false otherwise

setInputType

Added in 1.1.0
fun setInputType(inputType: Int): Unit

Sets the input type of the source as defined by InputType.

Note: Cannot be called from an android.accessibilityservice.AccessibilityService. This class is made immutable before being delivered to an AccessibilityService.

Parameters
inputType: Int

The input type.

Throws
java.lang.IllegalStateException

If called from an AccessibilityService.

setLabelFor

Added in 1.1.0
fun setLabelFor(labeled: View!): Unit

Sets the view for which the view represented by this info serves as a label for accessibility purposes.

Parameters
labeled: View!

The view for which this info serves as a label.

setLabelFor

Added in 1.1.0
fun setLabelFor(root: View!, virtualDescendantId: Int): Unit

Sets the view for which the view represented by this info serves as a label for accessibility purposes. If virtualDescendantId is NO_ID the root is set as the labeled.

A virtual descendant is an imaginary View that is reported as a part of the view hierarchy for accessibility purposes. This enables custom views that draw complex content to report themselves as a tree of virtual views, thus conveying their logical structure.

Parameters
root: View!

The root whose virtual descendant serves as a label.

virtualDescendantId: Int

The id of the virtual descendant.

setLabeledBy

Added in 1.1.0
fun setLabeledBy(label: View!): Unit

Sets the view which serves as the label of the view represented by this info for accessibility purposes.

Parameters
label: View!

The view that labels this node's source.

setLabeledBy

Added in 1.1.0
fun setLabeledBy(root: View!, virtualDescendantId: Int): Unit

Sets the view which serves as the label of the view represented by this info for accessibility purposes. If virtualDescendantId is NO_ID the root is set as the label.

A virtual descendant is an imaginary View that is reported as a part of the view hierarchy for accessibility purposes. This enables custom views that draw complex content to report themselves as a tree of virtual views, thus conveying their logical structure.

Note: Cannot be called from an android.accessibilityservice.AccessibilityService. This class is made immutable before being delivered to an AccessibilityService.

Parameters
root: View!

The root whose virtual descendant labels this node's source.

virtualDescendantId: Int

The id of the virtual descendant.

setLiveRegion

Added in 1.1.0
fun setLiveRegion(mode: Int): Unit

Sets the node's live region mode.

Note: Cannot be called from an android.accessibilityservice.AccessibilityService. This class is made immutable before being delivered to an AccessibilityService.

Parameters
mode: Int

The live region mode, or ACCESSIBILITY_LIVE_REGION_NONE if the view is not a live region.

setLongClickable

Added in 1.1.0
fun setLongClickable(longClickable: Boolean): Unit

Sets whether this node is long clickable.

Note: Cannot be called from an android.accessibilityservice.AccessibilityService. This class is made immutable before being delivered to an AccessibilityService.

Parameters
longClickable: Boolean

True if the node is long clickable.

Throws
java.lang.IllegalStateException

If called from an AccessibilityService.

setMaxTextLength

Added in 1.1.0
fun setMaxTextLength(max: Int): Unit

Sets the maximum text length, or -1 for no limit.

Typically used to indicate that an editable text field has a limit on the number of characters entered.

Note: Cannot be called from an android.accessibilityservice.AccessibilityService. This class is made immutable before being delivered to an AccessibilityService.

Parameters
max: Int

The maximum text length.

Throws
java.lang.IllegalStateException

If called from an AccessibilityService.

See also
getMaxTextLength

setMinDurationBetweenContentChangesMillis

Added in 1.10.0
fun setMinDurationBetweenContentChangesMillis(duration: Long): Unit

Sets the minimum time duration between two content change events, which is used in throttling content change events in accessibility services.

Example: An app can set MinDurationBetweenContentChanges as 1 min for a view which sends content change events to accessibility services one event per second. Accessibility service will throttle those content change events and only handle one event per minute for that view.

Parameters
duration: Long

the minimum duration between content change events.

See also
getContentChangeTypes

for all content change types.

setMovementGranularities

Added in 1.1.0
fun setMovementGranularities(granularities: Int): Unit

Sets the movement granularities for traversing the text of this node.

Note: Cannot be called from an android.accessibilityservice.AccessibilityService. This class is made immutable before being delivered to an AccessibilityService.

Parameters
granularities: Int

The bit mask with granularities.

Throws
java.lang.IllegalStateException

If called from an AccessibilityService.

setMultiLine

Added in 1.1.0
fun setMultiLine(multiLine: Boolean): Unit

Sets if the node is a multi line editable text.

Note: Cannot be called from an android.accessibilityservice.AccessibilityService. This class is made immutable before being delivered to an AccessibilityService.

Parameters
multiLine: Boolean

True if the node is multi line.

setPackageName

Added in 1.1.0
fun setPackageName(packageName: CharSequence!): Unit

Sets the package this node comes from.

Note: Cannot be called from an android.accessibilityservice.AccessibilityService. This class is made immutable before being delivered to an AccessibilityService.

Parameters
packageName: CharSequence!

The package name.

Throws
java.lang.IllegalStateException

If called from an AccessibilityService.

setPaneTitle

Added in 1.1.0
fun setPaneTitle(paneTitle: CharSequence?): Unit

If this node represents a visually distinct region of the screen that may update separately from the rest of the window, it is considered a pane. Set the pane title to indicate that the node is a pane, and to provide a title for it.

This method has no effect below API 19

Note: Cannot be called from an android.accessibilityservice.AccessibilityService. This class is made immutable before being delivered to an AccessibilityService.

Parameters
paneTitle: CharSequence?

The title of the window represented by this node.

setParent

Added in 1.1.0
fun setParent(parent: View!): Unit

Sets the parent.

Note: Cannot be called from an android.accessibilityservice.AccessibilityService. This class is made immutable before being delivered to an AccessibilityService.

Parameters
parent: View!

The parent.

Throws
java.lang.IllegalStateException

If called from an AccessibilityService.

setParent

Added in 1.1.0
fun setParent(root: View!, virtualDescendantId: Int): Unit

Sets the parent to be a virtual descendant of the given root. If virtualDescendantId equals to NO_ID the root is set as the parent.

A virtual descendant is an imaginary View that is reported as a part of the view hierarchy for accessibility purposes. This enables custom views that draw complex content to report them selves as a tree of virtual views, thus conveying their logical structure.

Note: Cannot be called from an android.accessibilityservice.AccessibilityService. This class is made immutable before being delivered to an AccessibilityService.

This method is not supported on devices running API level <16 since the platform did not support virtual descendants of real views.

Parameters
root: View!

The root of the virtual subtree.

virtualDescendantId: Int

The id of the virtual descendant.

setPassword

Added in 1.1.0
fun setPassword(password: Boolean): Unit

Sets whether this node is a password.

Note: Cannot be called from an android.accessibilityservice.AccessibilityService. This class is made immutable before being delivered to an AccessibilityService.

Parameters
password: Boolean

True if the node is a password.

Throws
java.lang.IllegalStateException

If called from an AccessibilityService.

setQueryFromAppProcessEnabled

Added in 1.12.0
fun setQueryFromAppProcessEnabled(view: View, enabled: Boolean): Unit

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

Testing or debugging tools should create this AccessibilityNodeInfoCompat node using onInitializeAccessibilityNodeInfo or AccessibilityNodeProviderCompat 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:

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. AccessibilityNodeInfoCompat 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.

Compatibility:

  • API <34: No-op
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.

Throws
java.lang.IllegalStateException

If called from an AccessibilityService, or if provided a View that is not attached to a window.

setRangeInfo

Added in 1.1.0
fun setRangeInfo(rangeInfo: AccessibilityNodeInfoCompat.RangeInfoCompat!): Unit

Sets the range info if this node is a range.

Note: Cannot be called from an android.accessibilityservice.AccessibilityService. This class is made immutable before being delivered to an AccessibilityService.

Parameters
rangeInfo: AccessibilityNodeInfoCompat.RangeInfoCompat!

The range info.

setRequestInitialAccessibilityFocus

Added in 1.10.0
fun setRequestInitialAccessibilityFocus(
    requestInitialAccessibilityFocus: Boolean
): Unit

Sets whether the node has requested initial accessibility focus.

If the node hasRequestInitialAccessibilityFocus, this node would be one of candidates to be accessibility focused when the window appears.

Note: Cannot be called from an android.accessibilityservice.AccessibilityService. This class is made immutable before being delivered to an AccessibilityService.

Parameters
requestInitialAccessibilityFocus: Boolean

True if the node requests to receive initial accessibility focus.

Throws
java.lang.IllegalStateException

If called from an AccessibilityService.

setRoleDescription

Added in 1.1.0
fun setRoleDescription(roleDescription: CharSequence?): Unit

Sets the custom role description.

The role description allows you to customize the name for the view's semantic role. For example, if you create a custom subclass of android.view.View to display a menu bar, you could assign it the role description of "menu bar".

Warning: For consistency with other applications, you should not use the role description to force accessibility services to describe standard views (such as buttons or checkboxes) using specific wording. For example, you should not set a role description of "check box" or "tick box" for a standard android.widget.CheckBox. Instead let accessibility services decide what feedback to provide.

Note: Cannot be called from an android.accessibilityservice.AccessibilityService. This class is made immutable before being delivered to an AccessibilityService.

Parameters
roleDescription: CharSequence?

The role description.

setScreenReaderFocusable

Added in 1.1.0
fun setScreenReaderFocusable(screenReaderFocusable: Boolean): Unit

Sets whether the node should be considered a focusable unit by a screen reader.

This method has no effect below API 19

Note: Cannot be called from an android.accessibilityservice.AccessibilityService. This class is made immutable before being delivered to an AccessibilityService.

Parameters
screenReaderFocusable: Boolean

true if the node is a focusable unit for screen readers, false otherwise.

setScrollable

Added in 1.1.0
fun setScrollable(scrollable: Boolean): Unit

Sets if the node is scrollable.

Note: Cannot be called from an android.accessibilityservice.AccessibilityService. This class is made immutable before being delivered to an AccessibilityService.

Parameters
scrollable: Boolean

True if the node is scrollable, false otherwise.

Throws
java.lang.IllegalStateException

If called from an AccessibilityService.

setSelected

Added in 1.1.0
fun setSelected(selected: Boolean): Unit

Sets whether this node is selected.

Note: Cannot be called from an android.accessibilityservice.AccessibilityService. This class is made immutable before being delivered to an AccessibilityService.

Parameters
selected: Boolean

True if the node is selected.

Throws
java.lang.IllegalStateException

If called from an AccessibilityService.

setShowingHintText

Added in 1.1.0
fun setShowingHintText(showingHintText: Boolean): Unit

Sets whether the node's text represents a hint for the user to enter text. It should only be true if the node has editable text.

This method has no effect below API 19

Note: Cannot be called from an android.accessibilityservice.AccessibilityService. This class is made immutable before being delivered to an AccessibilityService.

Parameters
showingHintText: Boolean

true if the text in the node represents a hint to the user, false otherwise.

setSource

Added in 1.1.0
fun setSource(source: View!): Unit

Sets the source.

Parameters
source: View!

The info source.

setSource

Added in 1.1.0
fun setSource(root: View!, virtualDescendantId: Int): Unit

Sets the source to be a virtual descendant of the given root. If virtualDescendantId is NO_ID the root is set as the source.

A virtual descendant is an imaginary View that is reported as a part of the view hierarchy for accessibility purposes. This enables custom views that draw complex content to report themselves as a tree of virtual views, thus conveying their logical structure.

Note: Cannot be called from an android.accessibilityservice.AccessibilityService. This class is made immutable before being delivered to an AccessibilityService.

This method is not supported on devices running API level <16 since the platform did not support virtual descendants of real views.

Parameters
root: View!

The root of the virtual subtree.

virtualDescendantId: Int

The id of the virtual descendant.

setStateDescription

Added in 1.5.0
fun setStateDescription(stateDescription: CharSequence?): Unit

Sets the state description of this node.

Note: Cannot be called from an android.accessibilityservice.AccessibilityService. This class is made immutable before being delivered to an AccessibilityService.

Parameters
stateDescription: CharSequence?

the state description of this node.

Throws
java.lang.IllegalStateException

If called from an AccessibilityService.

setText

Added in 1.1.0
fun setText(text: CharSequence!): Unit

Sets the text of this node.

Note: Cannot be called from an android.accessibilityservice.AccessibilityService. This class is made immutable before being delivered to an AccessibilityService.

Parameters
text: CharSequence!

The text.

Throws
java.lang.IllegalStateException

If called from an AccessibilityService.

setTextEntryKey

Added in 1.1.0
fun setTextEntryKey(isTextEntryKey: Boolean): Unit

Sets whether the node represents a text entry key that is part of a keyboard or keypad.

This method has no effect below API 19

Note: Cannot be called from an android.accessibilityservice.AccessibilityService. This class is made immutable before being delivered to an AccessibilityService.

Parameters
isTextEntryKey: Boolean

true if the node is a text entry key, false otherwise.

setTextSelectable

Added in 1.9.0
fun setTextSelectable(selectableText: Boolean): Unit

Sets if the node has selectable text.

Note: Cannot be called from an android.accessibilityservice.AccessibilityService. This class is made immutable before being delivered to an AccessibilityService.

Compatibility:

  • Api <19: Does not operate.
Parameters
selectableText: Boolean

True if the node has selectable text, false otherwise.

Throws
java.lang.IllegalStateException

If called from an AccessibilityService.

setTextSelection

Added in 1.1.0
fun setTextSelection(start: Int, end: Int): Unit

Sets the text selection start and end.

Note: Cannot be called from an android.accessibilityservice.AccessibilityService. This class is made immutable before being delivered to an AccessibilityService.

Parameters
start: Int

The text selection start.

end: Int

The text selection end.

Throws
java.lang.IllegalStateException

If called from an AccessibilityService.

setTooltipText

Added in 1.1.0
fun setTooltipText(tooltipText: CharSequence?): Unit

Sets the tooltip text of this node.

This method has no effect below API 19

Note: Cannot be called from an android.accessibilityservice.AccessibilityService. This class is made immutable before being delivered to an AccessibilityService.

Parameters
tooltipText: CharSequence?

The tooltip text.

Throws
java.lang.IllegalStateException

If called from an AccessibilityService.

setTouchDelegateInfo

Added in 1.2.0
fun setTouchDelegateInfo(
    delegatedInfo: AccessibilityNodeInfoCompat.TouchDelegateInfoCompat
): Unit

Set touch delegate info if the represented view has a android.view.TouchDelegate.

Note: Cannot be called from an android.accessibilityservice.AccessibilityService. This class is made immutable before being delivered to an AccessibilityService.

Compatibility:

  • API <29: No-op
Throws
java.lang.IllegalStateException

If called from an AccessibilityService.

setTraversalAfter

Added in 1.1.0
fun setTraversalAfter(view: View!): Unit

Sets the view whose node is visited after this one in accessibility traversal. A screen-reader must visit the content of the other node before the content of this one.

Note: Cannot be called from an android.accessibilityservice.AccessibilityService. This class is made immutable before being delivered to an AccessibilityService.

Parameters
view: View!

The previous view.

setTraversalAfter

Added in 1.1.0
fun setTraversalAfter(root: View!, virtualDescendantId: Int): Unit

Sets the node after which this one is visited in accessibility traversal. A screen-reader must visit the content of the other node before the content of this one. If virtualDescendantId equals to NO_ID the root is set as the predecessor.

A virtual descendant is an imaginary View that is reported as a part of the view hierarchy for accessibility purposes. This enables custom views that draw complex content to report them selves as a tree of virtual views, thus conveying their logical structure.

Note: Cannot be called from an android.accessibilityservice.AccessibilityService. This class is made immutable before being delivered to an AccessibilityService.

Parameters
root: View!

The root of the virtual subtree.

virtualDescendantId: Int

The id of the virtual descendant.

setTraversalBefore

Added in 1.1.0
fun setTraversalBefore(view: View!): Unit

Sets the view before whose node this one should be visited during traversal. A screen-reader must visit the content of this node before the content of the one it precedes.

Note: Cannot be called from an android.accessibilityservice.AccessibilityService. This class is made immutable before being delivered to an AccessibilityService.

Parameters
view: View!

The view providing the preceding node.

setTraversalBefore

Added in 1.1.0
fun setTraversalBefore(root: View!, virtualDescendantId: Int): Unit

Sets the node before which this one is visited during traversal. A screen-reader must visit the content of this node before the content of the one it precedes. The successor is a virtual descendant of the given root. If virtualDescendantId equals to NO_ID the root is set as the successor.

A virtual descendant is an imaginary View that is reported as a part of the view hierarchy for accessibility purposes. This enables custom views that draw complex content to report them selves as a tree of virtual views, thus conveying their logical structure.

Note: Cannot be called from an android.accessibilityservice.AccessibilityService. This class is made immutable before being delivered to an AccessibilityService.

Parameters
root: View!

The root of the virtual subtree.

virtualDescendantId: Int

The id of the virtual descendant.

setUniqueId

Added in 1.9.0
fun setUniqueId(uniqueId: String?): Unit

Sets the unique id of this node.

Note: Cannot be called from an android.accessibilityservice.AccessibilityService. This class is made immutable before being delivered to an AccessibilityService.

Parameters
uniqueId: String?

the unique id of this node.

Throws
java.lang.IllegalStateException

If called from an AccessibilityService.

setViewIdResourceName

Added in 1.1.0
fun setViewIdResourceName(viewId: String!): Unit

Sets the fully qualified resource name of the source view's id.

Note: Cannot be called from an android.accessibilityservice.AccessibilityService. This class is made immutable before being delivered to an AccessibilityService.

Parameters
viewId: String!

The id resource name.

setVisibleToUser

Added in 1.1.0
fun setVisibleToUser(visibleToUser: Boolean): Unit

Sets whether this node is visible to the user.

Note: Cannot be called from an android.accessibilityservice.AccessibilityService. This class is made immutable before being delivered to an AccessibilityService.

Parameters
visibleToUser: Boolean

Whether the node is visible to the user.

Throws
java.lang.IllegalStateException

If called from an AccessibilityService.

toString

fun toString(): String

wrap

Added in 1.1.0
java-static fun wrap(info: AccessibilityNodeInfo): AccessibilityNodeInfoCompat!

Creates a new instance wrapping an android.view.accessibility.AccessibilityNodeInfo.

Parameters
info: AccessibilityNodeInfo

The info.