added in version 22.1.0
belongs to Maven artifact com.android.support:support-compat:28.0.0-alpha1

AccessibilityNodeInfoCompat

public class AccessibilityNodeInfoCompat
extends Object

java.lang.Object
   ↳ android.support.v4.view.accessibility.AccessibilityNodeInfoCompat


Helper for accessing AccessibilityNodeInfo in a backwards compatible fashion.

Summary

Nested classes

class AccessibilityNodeInfoCompat.AccessibilityActionCompat

 

class AccessibilityNodeInfoCompat.CollectionInfoCompat

Class with information if a node is a collection. 

class AccessibilityNodeInfoCompat.CollectionItemInfoCompat

Class with information if a node is a collection item. 

class AccessibilityNodeInfoCompat.RangeInfoCompat

Class with information if a node is a range. 

Constants

int ACTION_ACCESSIBILITY_FOCUS

Action that gives accessibility focus to the node.

String ACTION_ARGUMENT_COLUMN_INT

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

String ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN

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

String ACTION_ARGUMENT_HTML_ELEMENT_STRING

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

String ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT

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

String ACTION_ARGUMENT_MOVE_WINDOW_X

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

String ACTION_ARGUMENT_MOVE_WINDOW_Y

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

String ACTION_ARGUMENT_PROGRESS_VALUE

Argument for specifying the progress value to set.

String ACTION_ARGUMENT_ROW_INT

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

String ACTION_ARGUMENT_SELECTION_END_INT

Argument for specifying the selection end.

String ACTION_ARGUMENT_SELECTION_START_INT

Argument for specifying the selection start.

String ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE

Argument for specifying the text content to set

Type: CharSequence
Actions: ACTION_SET_TEXT

int ACTION_CLEAR_ACCESSIBILITY_FOCUS

Action that clears accessibility focus of the node.

int ACTION_CLEAR_FOCUS

Action that unfocuses the node.

int ACTION_CLEAR_SELECTION

Action that unselects the node.

int ACTION_CLICK

Action that clicks on the node info.

int ACTION_COLLAPSE

Action to collapse an expandable node.

int ACTION_COPY

Action to copy the current selection to the clipboard.

int ACTION_CUT

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

int ACTION_DISMISS

Action to dismiss a dismissable node.

int ACTION_EXPAND

Action to expand an expandable node.

int ACTION_FOCUS

Action that focuses the node.

int ACTION_LONG_CLICK

Action that long clicks on the node.

int ACTION_NEXT_AT_MOVEMENT_GRANULARITY

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

int ACTION_NEXT_HTML_ELEMENT

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

int ACTION_PASTE

Action to paste the current clipboard content.

int ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY

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

int ACTION_PREVIOUS_HTML_ELEMENT

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

int ACTION_SCROLL_BACKWARD

Action to scroll the node content backward.

int ACTION_SCROLL_FORWARD

Action to scroll the node content forward.

int ACTION_SELECT

Action that selects the node.

int ACTION_SET_SELECTION

Action to set the selection.

int ACTION_SET_TEXT

Action that sets the text of the node.

int FOCUS_ACCESSIBILITY

The accessibility focus.

int FOCUS_INPUT

The input focus.

int MOVEMENT_GRANULARITY_CHARACTER

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

int MOVEMENT_GRANULARITY_LINE

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

int MOVEMENT_GRANULARITY_PAGE

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

int MOVEMENT_GRANULARITY_PARAGRAPH

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

int MOVEMENT_GRANULARITY_WORD

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

Public constructors

AccessibilityNodeInfoCompat(Object info)

This constructor was deprecated in API level 26.1.0. Use wrap(AccessibilityNodeInfo) instead.

Public methods

void addAction(int action)

Adds an action that can be performed on the node.

void addAction(AccessibilityNodeInfoCompat.AccessibilityActionCompat action)

Adds an action that can be performed on the node.

void addChild(View root, int virtualDescendantId)

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

void addChild(View child)

Adds a child.

boolean canOpenPopup()

Gets if this node opens a popup or a dialog.

boolean equals(Object obj)
List<AccessibilityNodeInfoCompat> findAccessibilityNodeInfosByText(String text)

Finds AccessibilityNodeInfos by text.

List<AccessibilityNodeInfoCompat> findAccessibilityNodeInfosByViewId(String viewId)

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(int focus)

Find the view that has the specified focus type.

AccessibilityNodeInfoCompat focusSearch(int direction)

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

List<AccessibilityNodeInfoCompat.AccessibilityActionCompat> getActionList()

Gets the actions that can be performed on the node.

int getActions()

Gets the actions that can be performed on the node.

void getBoundsInParent(Rect outBounds)

Gets the node bounds in parent coordinates.

void getBoundsInScreen(Rect outBounds)

Gets the node bounds in screen coordinates.

AccessibilityNodeInfoCompat getChild(int index)

Get the child at given index.

int getChildCount()

Gets the number of children.

CharSequence getClassName()

Gets the class this node comes from.

AccessibilityNodeInfoCompat.CollectionInfoCompat getCollectionInfo()

Gets the collection info if the node is a collection.

AccessibilityNodeInfoCompat.CollectionItemInfoCompat getCollectionItemInfo()

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

CharSequence getContentDescription()

Gets the content description of this node.

int getDrawingOrder()

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

CharSequence getError()

Gets the error text of this node.

Bundle getExtras()

Gets an optional bundle with extra data.

CharSequence getHintText()

Gets the hint text of this node.

Object getInfo()

This method was deprecated in API level 26.1.0. Use unwrap() instead.

int getInputType()

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

AccessibilityNodeInfoCompat getLabelFor()

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

AccessibilityNodeInfoCompat getLabeledBy()

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

int getLiveRegion()

Gets the node's live region mode.

int getMaxTextLength()

Returns the maximum text length for this node.

int getMovementGranularities()

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

CharSequence getPackageName()

Gets the package this node comes from.

CharSequence getPaneTitle()

Get the title of the pane represented by this node.

AccessibilityNodeInfoCompat getParent()

Gets the parent.

AccessibilityNodeInfoCompat.RangeInfoCompat getRangeInfo()

Gets the range info if this node is a range.

CharSequence getRoleDescription()

Gets the custom role description.

CharSequence getText()

Gets the text of this node.

int getTextSelectionEnd()

Gets the text selection end.

int getTextSelectionStart()

Gets the text selection start.

CharSequence getTooltipText()

Gets the tooltip text of this node.

AccessibilityNodeInfoCompat getTraversalAfter()

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

AccessibilityNodeInfoCompat getTraversalBefore()

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

String getViewIdResourceName()

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

AccessibilityWindowInfoCompat getWindow()

Gets the window to which this node belongs.

int getWindowId()

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

int hashCode()
boolean isAccessibilityFocused()

Gets whether this node is accessibility focused.

boolean isCheckable()

Gets whether this node is checkable.

boolean isChecked()

Gets whether this node is checked.

boolean isClickable()

Gets whether this node is clickable.

boolean isContentInvalid()

Gets if the content of this node is invalid.

boolean isContextClickable()

Gets whether this node is context clickable.

boolean isDismissable()

Gets if the node can be dismissed.

boolean isEditable()

Gets if the node is editable.

boolean isEnabled()

Gets whether this node is enabled.

boolean isFocusable()

Gets whether this node is focusable.

boolean isFocused()

Gets whether this node is focused.

boolean isHeading()

Returns whether node represents a heading.

boolean isImportantForAccessibility()

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

boolean isLongClickable()

Gets whether this node is long clickable.

boolean isMultiLine()

Gets if the node is a multi line editable text.

boolean isPassword()

Gets whether this node is a password.

boolean isScreenReaderFocusable()

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

boolean isScrollable()

Gets if the node is scrollable.

boolean isSelected()

Gets whether this node is selected.

boolean isShowingHintText()

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

boolean isVisibleToUser()

Gets whether this node is visible to the user.

static AccessibilityNodeInfoCompat obtain(View root, int virtualDescendantId)

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

static AccessibilityNodeInfoCompat obtain(AccessibilityNodeInfoCompat info)

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

static AccessibilityNodeInfoCompat obtain()

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

static AccessibilityNodeInfoCompat obtain(View source)

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

boolean performAction(int action, Bundle arguments)

Performs an action on the node.

boolean performAction(int action)

Performs an action on the node.

void recycle()

Return an instance back to be reused.

boolean refresh()

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

boolean removeAction(AccessibilityNodeInfoCompat.AccessibilityActionCompat action)

Removes an action that can be performed on the node.

boolean removeChild(View root, int virtualDescendantId)

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

boolean removeChild(View child)

Removes a child.

void setAccessibilityFocused(boolean focused)

Sets whether this node is accessibility focused.

void setBoundsInParent(Rect bounds)

Sets the node bounds in parent coordinates.

void setBoundsInScreen(Rect bounds)

Sets the node bounds in screen coordinates.

void setCanOpenPopup(boolean opensPopup)

Sets if this node opens a popup or a dialog.

void setCheckable(boolean checkable)

Sets whether this node is checkable.

void setChecked(boolean checked)

Sets whether this node is checked.

void setClassName(CharSequence className)

Sets the class this node comes from.

void setClickable(boolean clickable)

Sets whether this node is clickable.

void setCollectionInfo(Object collectionInfo)
void setCollectionItemInfo(Object collectionItemInfo)
void setContentDescription(CharSequence contentDescription)

Sets the content description of this node.

void setContentInvalid(boolean contentInvalid)

Sets if the content of this node is invalid.

void setContextClickable(boolean contextClickable)

Sets whether this node is context clickable.

void setDismissable(boolean dismissable)

Sets if the node can be dismissed.

void setDrawingOrder(int drawingOrderInParent)

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

void setEditable(boolean editable)

Sets whether this node is editable.

void setEnabled(boolean enabled)

Sets whether this node is enabled.

void setError(CharSequence error)

Sets the error text of this node.

void setFocusable(boolean focusable)

Sets whether this node is focusable.

void setFocused(boolean focused)

Sets whether this node is focused.

void setHeading(boolean isHeading)

Sets whether the node represents a heading.

void setHintText(CharSequence hintText)

Sets the hint text of this node.

void setImportantForAccessibility(boolean important)

Sets whether the node is considered important for accessibility.

void setInputType(int inputType)

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

void setLabelFor(View root, int virtualDescendantId)

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

void setLabelFor(View labeled)

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

void setLabeledBy(View label)

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

void setLabeledBy(View root, int virtualDescendantId)

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

void setLiveRegion(int mode)

Sets the node's live region mode.

void setLongClickable(boolean longClickable)

Sets whether this node is long clickable.

void setMaxTextLength(int max)

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

void setMovementGranularities(int granularities)

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

void setMultiLine(boolean multiLine)

Sets if the node is a multi line editable text.

void setPackageName(CharSequence packageName)

Sets the package this node comes from.

void setPaneTitle(CharSequence paneTitle)

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.

void setParent(View root, int virtualDescendantId)

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

void setParent(View parent)

Sets the parent.

void setPassword(boolean password)

Sets whether this node is a password.

void setRangeInfo(AccessibilityNodeInfoCompat.RangeInfoCompat rangeInfo)

Sets the range info if this node is a range.

void setRoleDescription(CharSequence roleDescription)

Sets the custom role description.

void setScreenReaderFocusable(boolean screenReaderFocusable)

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

void setScrollable(boolean scrollable)

Sets if the node is scrollable.

void setSelected(boolean selected)

Sets whether this node is selected.

void setShowingHintText(boolean showingHintText)

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

void setSource(View source)

Sets the source.

void setSource(View root, int virtualDescendantId)

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

void setText(CharSequence text)

Sets the text of this node.

void setTextSelection(int start, int end)

Sets the text selection start and end.

void setTooltipText(CharSequence tooltipText)

Sets the tooltip text of this node.

void setTraversalAfter(View view)

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

void setTraversalAfter(View root, int virtualDescendantId)

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

void setTraversalBefore(View view)

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

void setTraversalBefore(View root, int virtualDescendantId)

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

void setViewIdResourceName(String viewId)

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

void setVisibleToUser(boolean visibleToUser)

Sets whether this node is visible to the user.

String toString()
AccessibilityNodeInfo unwrap()
static AccessibilityNodeInfoCompat wrap(AccessibilityNodeInfo info)

Creates a new instance wrapping an AccessibilityNodeInfo.

Inherited methods

From class java.lang.Object

Constants

ACTION_ACCESSIBILITY_FOCUS

added in version 22.1.0
int ACTION_ACCESSIBILITY_FOCUS

Action that gives accessibility focus to the node.

Constant Value: 64 (0x00000040)

ACTION_ARGUMENT_COLUMN_INT

added in version 25.1.0
String ACTION_ARGUMENT_COLUMN_INT

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

Type: int
Actions:

Constant Value: "android.view.accessibility.action.ARGUMENT_COLUMN_INT"

ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN

added in version 22.1.0
String ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN

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

Type: boolean
Actions: ACTION_NEXT_AT_MOVEMENT_GRANULARITY, ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY

Constant Value: "ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN"

ACTION_ARGUMENT_HTML_ELEMENT_STRING

added in version 22.1.0
String ACTION_ARGUMENT_HTML_ELEMENT_STRING

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

Type: String
Actions: ACTION_NEXT_HTML_ELEMENT, ACTION_PREVIOUS_HTML_ELEMENT

Constant Value: "ACTION_ARGUMENT_HTML_ELEMENT_STRING"

ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT

added in version 22.1.0
String ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT

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

Type: int
Actions: ACTION_NEXT_AT_MOVEMENT_GRANULARITY, ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY

Constant Value: "ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT"

ACTION_ARGUMENT_MOVE_WINDOW_X

String ACTION_ARGUMENT_MOVE_WINDOW_X

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

Type: int
Actions:

See also:

Constant Value: "ACTION_ARGUMENT_MOVE_WINDOW_X"

ACTION_ARGUMENT_MOVE_WINDOW_Y

String ACTION_ARGUMENT_MOVE_WINDOW_Y

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

Type: int
Actions:

See also:

Constant Value: "ACTION_ARGUMENT_MOVE_WINDOW_Y"

ACTION_ARGUMENT_PROGRESS_VALUE

added in version 25.1.0
String ACTION_ARGUMENT_PROGRESS_VALUE

Argument for specifying the progress value to set.

Type: float
Actions:

Constant Value: "android.view.accessibility.action.ARGUMENT_PROGRESS_VALUE"

ACTION_ARGUMENT_ROW_INT

added in version 25.1.0
String ACTION_ARGUMENT_ROW_INT

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

Type: int
Actions:

Constant Value: "android.view.accessibility.action.ARGUMENT_ROW_INT"

ACTION_ARGUMENT_SELECTION_END_INT

added in version 22.1.0
String ACTION_ARGUMENT_SELECTION_END_INT

Argument for specifying the selection end.

Type: int
Actions: ACTION_SET_SELECTION

Constant Value: "ACTION_ARGUMENT_SELECTION_END_INT"

ACTION_ARGUMENT_SELECTION_START_INT

added in version 22.1.0
String ACTION_ARGUMENT_SELECTION_START_INT

Argument for specifying the selection start.

Type: int
Actions: ACTION_SET_SELECTION

Constant Value: "ACTION_ARGUMENT_SELECTION_START_INT"

ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE

added in version 22.1.0
String ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE

Argument for specifying the text content to set

Type: CharSequence
Actions: ACTION_SET_TEXT

See also:

Constant Value: "ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE"

ACTION_CLEAR_ACCESSIBILITY_FOCUS

added in version 22.1.0
int ACTION_CLEAR_ACCESSIBILITY_FOCUS

Action that clears accessibility focus of the node.

Constant Value: 128 (0x00000080)

ACTION_CLEAR_FOCUS

added in version 22.1.0
int ACTION_CLEAR_FOCUS

Action that unfocuses the node.

Constant Value: 2 (0x00000002)

ACTION_CLEAR_SELECTION

added in version 22.1.0
int ACTION_CLEAR_SELECTION

Action that unselects the node.

Constant Value: 8 (0x00000008)

ACTION_CLICK

added in version 22.1.0
int ACTION_CLICK

Action that clicks on the node info.

Constant Value: 16 (0x00000010)

ACTION_COLLAPSE

added in version 24.1.0
int ACTION_COLLAPSE

Action to collapse an expandable node.

Constant Value: 524288 (0x00080000)

ACTION_COPY

added in version 22.1.0
int ACTION_COPY

Action to copy the current selection to the clipboard.

Constant Value: 16384 (0x00004000)

ACTION_CUT

added in version 22.1.0
int ACTION_CUT

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

Constant Value: 65536 (0x00010000)

ACTION_DISMISS

added in version 24.1.0
int ACTION_DISMISS

Action to dismiss a dismissable node.

Constant Value: 1048576 (0x00100000)

ACTION_EXPAND

added in version 24.1.0
int ACTION_EXPAND

Action to expand an expandable node.

Constant Value: 262144 (0x00040000)

ACTION_FOCUS

added in version 22.1.0
int ACTION_FOCUS

Action that focuses the node.

Constant Value: 1 (0x00000001)

ACTION_LONG_CLICK

added in version 22.1.0
int ACTION_LONG_CLICK

Action that long clicks on the node.

Constant Value: 32 (0x00000020)

ACTION_NEXT_AT_MOVEMENT_GRANULARITY

added in version 22.1.0
int ACTION_NEXT_AT_MOVEMENT_GRANULARITY

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_BOOLEAN
Example: 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);

Constant Value: 256 (0x00000100)

ACTION_NEXT_HTML_ELEMENT

added in version 22.1.0
int ACTION_NEXT_HTML_ELEMENT

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_STRING
Example:

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

Constant Value: 1024 (0x00000400)

ACTION_PASTE

added in version 22.1.0
int ACTION_PASTE

Action to paste the current clipboard content.

Constant Value: 32768 (0x00008000)

ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY

added in version 22.1.0
int ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY

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_BOOLEAN
Example: 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);

Constant Value: 512 (0x00000200)

ACTION_PREVIOUS_HTML_ELEMENT

added in version 22.1.0
int ACTION_PREVIOUS_HTML_ELEMENT

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_STRING
Example:

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

Constant Value: 2048 (0x00000800)

ACTION_SCROLL_BACKWARD

added in version 22.1.0
int ACTION_SCROLL_BACKWARD

Action to scroll the node content backward.

Constant Value: 8192 (0x00002000)

ACTION_SCROLL_FORWARD

added in version 22.1.0
int ACTION_SCROLL_FORWARD

Action to scroll the node content forward.

Constant Value: 4096 (0x00001000)

ACTION_SELECT

added in version 22.1.0
int ACTION_SELECT

Action that selects the node.

Constant Value: 4 (0x00000004)

ACTION_SET_SELECTION

added in version 22.1.0
int ACTION_SET_SELECTION

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

Arguments: ACTION_ARGUMENT_SELECTION_START_INT, ACTION_ARGUMENT_SELECTION_END_INT
Example:

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);

Constant Value: 131072 (0x00020000)

ACTION_SET_TEXT

added in version 22.1.0
int ACTION_SET_TEXT

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_CHARSEQUENCE
Example:

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

Constant Value: 2097152 (0x00200000)

FOCUS_ACCESSIBILITY

added in version 22.1.0
int FOCUS_ACCESSIBILITY

The accessibility focus.

Constant Value: 2 (0x00000002)

FOCUS_INPUT

added in version 22.1.0
int FOCUS_INPUT

The input focus.

Constant Value: 1 (0x00000001)

MOVEMENT_GRANULARITY_CHARACTER

added in version 22.1.0
int MOVEMENT_GRANULARITY_CHARACTER

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

Constant Value: 1 (0x00000001)

MOVEMENT_GRANULARITY_LINE

added in version 22.1.0
int MOVEMENT_GRANULARITY_LINE

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

Constant Value: 4 (0x00000004)

MOVEMENT_GRANULARITY_PAGE

added in version 22.1.0
int MOVEMENT_GRANULARITY_PAGE

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

Constant Value: 16 (0x00000010)

MOVEMENT_GRANULARITY_PARAGRAPH

added in version 22.1.0
int MOVEMENT_GRANULARITY_PARAGRAPH

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

Constant Value: 8 (0x00000008)

MOVEMENT_GRANULARITY_WORD

added in version 22.1.0
int MOVEMENT_GRANULARITY_WORD

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

Constant Value: 2 (0x00000002)

Public constructors

AccessibilityNodeInfoCompat

added in version 22.1.0
AccessibilityNodeInfoCompat (Object info)

This constructor was deprecated in API level 26.1.0.
Use wrap(AccessibilityNodeInfo) instead.

Creates a new instance wrapping an AccessibilityNodeInfo.

Parameters
info Object: The info.

Public methods

addAction

added in version 22.1.0
void addAction (int action)

Adds an action that can be performed on the node.

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

Parameters
action int: The action.

Throws
IllegalStateException If called from an AccessibilityService.

addAction

added in version 22.1.0
void addAction (AccessibilityNodeInfoCompat.AccessibilityActionCompat action)

Adds an action that can be performed on the node.

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

Parameters
action AccessibilityNodeInfoCompat.AccessibilityActionCompat: The action.

Throws
IllegalStateException If called from an AccessibilityService.

addChild

added in version 22.1.0
void addChild (View root, 
                int virtualDescendantId)

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.

addChild

added in version 22.1.0
void addChild (View child)

Adds a child.

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

Parameters
child View: The child.

Throws
IllegalStateException If called from an AccessibilityService.

canOpenPopup

added in version 24.1.0
boolean canOpenPopup ()

Gets if this node opens a popup or a dialog.

Returns
boolean If the the node opens a popup.

equals

boolean equals (Object obj)

Parameters
obj Object

Returns
boolean

findAccessibilityNodeInfosByText

added in version 22.1.0
List<AccessibilityNodeInfoCompat> findAccessibilityNodeInfosByText (String text)

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

Note: It is a client responsibility to recycle the received info by calling recycle() to avoid creating of multiple instances.

Parameters
text String: The searched text.

Returns
List<AccessibilityNodeInfoCompat> A list of node info.

findAccessibilityNodeInfosByViewId

added in version 24.1.0
List<AccessibilityNodeInfoCompat> findAccessibilityNodeInfosByViewId (String viewId)

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: It is a client responsibility to recycle the received info by calling recycle() to avoid creating of multiple instances.

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 the AccessibilityService.

Parameters
viewId String: The fully qualified resource name of the view id to find.

Returns
List<AccessibilityNodeInfoCompat> A list of node info.

findFocus

added in version 22.1.0
AccessibilityNodeInfoCompat findFocus (int focus)

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 version 22.1.0
AccessibilityNodeInfoCompat focusSearch (int direction)

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 version 22.1.0
List<AccessibilityNodeInfoCompat.AccessibilityActionCompat> getActionList ()

Gets the actions that can be performed on the node.

Returns
List<AccessibilityNodeInfoCompat.AccessibilityActionCompat> A list of AccessibilityActions.

getActions

added in version 22.1.0
int getActions ()

Gets the actions that can be performed on the node.

Returns
int The bit mask of with actions.

getBoundsInParent

added in version 22.1.0
void getBoundsInParent (Rect outBounds)

Gets the node bounds in parent coordinates.

Parameters
outBounds Rect: The output node bounds.

getBoundsInScreen

added in version 22.1.0
void getBoundsInScreen (Rect outBounds)

Gets the node bounds in screen coordinates.

Parameters
outBounds Rect: The output node bounds.

getChild

added in version 22.1.0
AccessibilityNodeInfoCompat getChild (int index)

Get the child at given index.

Note: It is a client responsibility to recycle the received info by calling recycle() to avoid creating of multiple instances.

Parameters
index int: The child index.

Returns
AccessibilityNodeInfoCompat The child node.

Throws
IllegalStateException If called outside of an AccessibilityService.

getChildCount

added in version 22.1.0
int getChildCount ()

Gets the number of children.

Returns
int The child count.

getClassName

added in version 22.1.0
CharSequence getClassName ()

Gets the class this node comes from.

Returns
CharSequence The class name.

getCollectionInfo

added in version 22.1.0
AccessibilityNodeInfoCompat.CollectionInfoCompat getCollectionInfo ()

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 version 22.1.0
AccessibilityNodeInfoCompat.CollectionItemInfoCompat getCollectionItemInfo ()

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.

getContentDescription

added in version 22.1.0
CharSequence getContentDescription ()

Gets the content description of this node.

Returns
CharSequence The content description.

getDrawingOrder

added in version 24.1.0
int getDrawingOrder ()

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 version 22.1.0
CharSequence getError ()

Gets the error text of this node.

Returns
CharSequence The error text.

getExtras

added in version 24.1.0
Bundle getExtras ()

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

CharSequence getHintText ()

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

Returns
CharSequence The hint text.

getInfo

added in version 22.1.0
Object getInfo ()

This method was deprecated in API level 26.1.0.
Use unwrap() instead.

Returns
Object The wrapped AccessibilityNodeInfo.

getInputType

added in version 24.1.0
int getInputType ()

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

Returns
int The input type.

getLabelFor

added in version 24.1.0
AccessibilityNodeInfoCompat getLabelFor ()

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

Note: It is a client responsibility to recycle the received info by calling recycle() to avoid creating of multiple instances.

Returns
AccessibilityNodeInfoCompat The labeled info.

getLabeledBy

added in version 24.1.0
AccessibilityNodeInfoCompat getLabeledBy ()

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

Note: It is a client responsibility to recycle the received info by calling recycle() to avoid creating of multiple instances.

Returns
AccessibilityNodeInfoCompat The label.

getLiveRegion

added in version 22.1.0
int getLiveRegion ()

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 version 24.1.0
int getMaxTextLength ()

Returns the maximum text length for this node.

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

getMovementGranularities

added in version 22.1.0
int getMovementGranularities ()

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

Returns
int The bit mask with granularities.

getPackageName

added in version 22.1.0
CharSequence getPackageName ()

Gets the package this node comes from.

Returns
CharSequence The package name.

getPaneTitle

CharSequence getPaneTitle ()

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 version 22.1.0
AccessibilityNodeInfoCompat getParent ()

Gets the parent.

Note: It is a client responsibility to recycle the received info by calling recycle() to avoid creating of multiple instances.

Returns
AccessibilityNodeInfoCompat The parent.

getRangeInfo

added in version 22.1.0
AccessibilityNodeInfoCompat.RangeInfoCompat getRangeInfo ()

Gets the range info if this node is a range.

Returns
AccessibilityNodeInfoCompat.RangeInfoCompat The range.

getRoleDescription

added in version 24.1.0
CharSequence getRoleDescription ()

Gets the custom role description.

Returns
CharSequence The role description.

getText

added in version 22.1.0
CharSequence getText ()

Gets the text of this node.

Returns
CharSequence The text.

getTextSelectionEnd

added in version 24.1.0
int getTextSelectionEnd ()

Gets the text selection end.

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

getTextSelectionStart

added in version 24.1.0
int getTextSelectionStart ()

Gets the text selection start.

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

getTooltipText

CharSequence getTooltipText ()

Gets the tooltip text of this node.

Returns
CharSequence The tooltip text.

getTraversalAfter

added in version 24.1.0
AccessibilityNodeInfoCompat getTraversalAfter ()

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 version 24.1.0
AccessibilityNodeInfoCompat getTraversalBefore ()

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.

getViewIdResourceName

added in version 22.1.0
String getViewIdResourceName ()

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 the AccessibilityService.

Returns
String The id resource name.

getWindow

added in version 24.1.0
AccessibilityWindowInfoCompat getWindow ()

Gets the window to which this node belongs.

Returns
AccessibilityWindowInfoCompat The window.

See also:

getWindowId

added in version 22.1.0
int getWindowId ()

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

Returns
int The window id.

hashCode

int hashCode ()

Returns
int

isAccessibilityFocused

added in version 22.1.0
boolean isAccessibilityFocused ()

Gets whether this node is accessibility focused.

Returns
boolean True if the node is accessibility focused.

isCheckable

added in version 22.1.0
boolean isCheckable ()

Gets whether this node is checkable.

Returns
boolean True if the node is checkable.

isChecked

added in version 22.1.0
boolean isChecked ()

Gets whether this node is checked.

Returns
boolean True if the node is checked.

isClickable

added in version 22.1.0
boolean isClickable ()

Gets whether this node is clickable.

Returns
boolean True if the node is clickable.

isContentInvalid

added in version 22.1.0
boolean isContentInvalid ()

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 version 25.1.0
boolean isContextClickable ()

Gets whether this node is context clickable.

Returns
boolean True if the node is context clickable.

isDismissable

added in version 24.1.0
boolean isDismissable ()

Gets if the node can be dismissed.

Returns
boolean If the node can be dismissed.

isEditable

added in version 24.1.0
boolean isEditable ()

Gets if the node is editable.

Returns
boolean True if the node is editable, false otherwise.

isEnabled

added in version 22.1.0
boolean isEnabled ()

Gets whether this node is enabled.

Returns
boolean True if the node is enabled.

isFocusable

added in version 22.1.0
boolean isFocusable ()

Gets whether this node is focusable.

Returns
boolean True if the node is focusable.

isFocused

added in version 22.1.0
boolean isFocused ()

Gets whether this node is focused.

Returns
boolean True if the node is focused.

isHeading

boolean isHeading ()

Returns whether node represents a heading.

Returns
boolean true if the node is a heading, false otherwise.

isImportantForAccessibility

added in version 24.1.0
boolean isImportantForAccessibility ()

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 version 22.1.0
boolean isLongClickable ()

Gets whether this node is long clickable.

Returns
boolean True if the node is long clickable.

isMultiLine

added in version 24.1.0
boolean isMultiLine ()

Gets if the node is a multi line editable text.

Returns
boolean True if the node is multi line.

isPassword

added in version 22.1.0
boolean isPassword ()

Gets whether this node is a password.

Returns
boolean True if the node is a password.

isScreenReaderFocusable

boolean isScreenReaderFocusable ()

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 version 22.1.0
boolean isScrollable ()

Gets if the node is scrollable.

Returns
boolean True if the node is scrollable, false otherwise.

isSelected

added in version 22.1.0
boolean isSelected ()

Gets whether this node is selected.

Returns
boolean True if the node is selected.

isShowingHintText

boolean isShowingHintText ()

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.

isVisibleToUser

added in version 22.1.0
boolean isVisibleToUser ()

Gets whether this node is visible to the user.

Returns
boolean Whether the node is visible to the user.

obtain

added in version 22.1.0
AccessibilityNodeInfoCompat obtain (View root, 
                int virtualDescendantId)

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.

obtain

added in version 22.1.0
AccessibilityNodeInfoCompat obtain (AccessibilityNodeInfoCompat info)

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 version 22.1.0
AccessibilityNodeInfoCompat obtain ()

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

Returns
AccessibilityNodeInfoCompat An instance.

obtain

added in version 22.1.0
AccessibilityNodeInfoCompat obtain (View source)

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

Parameters
source View

Returns
AccessibilityNodeInfoCompat An instance.

See also:

performAction

added in version 22.1.0
boolean performAction (int action, 
                Bundle arguments)

Performs an action on the node.

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

Parameters
action int: The action to perform.

arguments Bundle: A bundle with additional arguments.

Returns
boolean True if the action was performed.

Throws
IllegalStateException If called outside of an AccessibilityService.

performAction

added in version 22.1.0
boolean performAction (int action)

Performs an action on the node.

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

Parameters
action int: The action to perform.

Returns
boolean True if the action was performed.

Throws
IllegalStateException If called outside of an AccessibilityService.

recycle

added in version 22.1.0
void recycle ()

Return an instance back to be reused.

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

Throws
IllegalStateException If the info is already recycled.

refresh

added in version 24.1.0
boolean refresh ()

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 and should be recycled.

Returns
boolean Whether the refresh succeeded.

removeAction

added in version 24.1.0
boolean removeAction (AccessibilityNodeInfoCompat.AccessibilityActionCompat action)

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 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
IllegalStateException If called from an AccessibilityService.

removeChild

added in version 24.1.0
boolean removeChild (View root, 
                int virtualDescendantId)

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

removeChild

added in version 24.1.0
boolean removeChild (View child)

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 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
IllegalStateException If called from an AccessibilityService.

setAccessibilityFocused

added in version 22.1.0
void setAccessibilityFocused (boolean focused)

Sets whether this node is accessibility focused.

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

Parameters
focused boolean: True if the node is accessibility focused.

Throws
IllegalStateException If called from an AccessibilityService.

setBoundsInParent

added in version 22.1.0
void setBoundsInParent (Rect bounds)

Sets the node bounds in parent coordinates.

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

Parameters
bounds Rect: The node bounds.

Throws
IllegalStateException If called from an AccessibilityService.

setBoundsInScreen

added in version 22.1.0
void setBoundsInScreen (Rect bounds)

Sets the node bounds in screen coordinates.

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

Parameters
bounds Rect: The node bounds.

Throws
IllegalStateException If called from an AccessibilityService.

setCanOpenPopup

added in version 24.1.0
void setCanOpenPopup (boolean opensPopup)

Sets if this node opens a popup or a dialog.

Note: Cannot be called from an 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 version 22.1.0
void setCheckable (boolean checkable)

Sets whether this node is checkable.

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

Parameters
checkable boolean: True if the node is checkable.

Throws
IllegalStateException If called from an AccessibilityService.

setChecked

added in version 22.1.0
void setChecked (boolean checked)

Sets whether this node is checked.

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

Parameters
checked boolean: True if the node is checked.

Throws
IllegalStateException If called from an AccessibilityService.

setClassName

added in version 22.1.0
void setClassName (CharSequence className)

Sets the class this node comes from.

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

Parameters
className CharSequence: The class name.

Throws
IllegalStateException If called from an AccessibilityService.

setClickable

added in version 22.1.0
void setClickable (boolean clickable)

Sets whether this node is clickable.

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

Parameters
clickable boolean: True if the node is clickable.

Throws
IllegalStateException If called from an AccessibilityService.

setCollectionInfo

added in version 22.1.0
void setCollectionInfo (Object collectionInfo)

Parameters
collectionInfo Object

setCollectionItemInfo

added in version 22.1.0
void setCollectionItemInfo (Object collectionItemInfo)

Parameters
collectionItemInfo Object

setContentDescription

added in version 22.1.0
void setContentDescription (CharSequence contentDescription)

Sets the content description of this node.

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

Parameters
contentDescription CharSequence: The content description.

Throws
IllegalStateException If called from an AccessibilityService.

setContentInvalid

added in version 22.1.0
void setContentInvalid (boolean contentInvalid)

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

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

Parameters
contentInvalid boolean: If the node content is invalid.

setContextClickable

added in version 25.1.0
void setContextClickable (boolean contextClickable)

Sets whether this node is context clickable.

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

Parameters
contextClickable boolean: True if the node is context clickable.

Throws
IllegalStateException If called from an AccessibilityService.

setDismissable

added in version 24.1.0
void setDismissable (boolean dismissable)

Sets if the node can be dismissed.

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

Parameters
dismissable boolean: If the node can be dismissed.

setDrawingOrder

added in version 24.1.0
void setDrawingOrder (int drawingOrderInParent)

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

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

Throws
IllegalStateException If called from an AccessibilityService.

setEditable

added in version 24.1.0
void setEditable (boolean editable)

Sets whether this node is editable.

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

Parameters
editable boolean: True if the node is editable.

Throws
IllegalStateException If called from an AccessibilityService.

setEnabled

added in version 22.1.0
void setEnabled (boolean enabled)

Sets whether this node is enabled.

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

Parameters
enabled boolean: True if the node is enabled.

Throws
IllegalStateException If called from an AccessibilityService.

setError

added in version 22.1.0
void setError (CharSequence error)

Sets the error text of this node.

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

Parameters
error CharSequence: The error text.

Throws
IllegalStateException If called from an AccessibilityService.

setFocusable

added in version 22.1.0
void setFocusable (boolean focusable)

Sets whether this node is focusable.

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

Parameters
focusable boolean: True if the node is focusable.

Throws
IllegalStateException If called from an AccessibilityService.

setFocused

added in version 22.1.0
void setFocused (boolean focused)

Sets whether this node is focused.

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

Parameters
focused boolean: True if the node is focused.

Throws
IllegalStateException If called from an AccessibilityService.

setHeading

void setHeading (boolean isHeading)

Sets whether the node represents a heading.

This method has no effect below API 19

Note: Cannot be called from an 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

void setHintText (CharSequence hintText)

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 AccessibilityService. This class is made immutable before being delivered to an AccessibilityService.

Parameters
hintText CharSequence: The hint text for this mode.

Throws
IllegalStateException If called from an AccessibilityService.

setImportantForAccessibility

added in version 24.1.0
void setImportantForAccessibility (boolean important)

Sets whether the node is considered important for accessibility.

Note: Cannot be called from an 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 version 24.1.0
void setInputType (int inputType)

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

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

Parameters
inputType int: The input type.

Throws
IllegalStateException If called from an AccessibilityService.

setLabelFor

added in version 22.1.0
void setLabelFor (View root, 
                int virtualDescendantId)

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.

setLabelFor

added in version 22.1.0
void setLabelFor (View labeled)

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.

setLabeledBy

added in version 24.1.0
void setLabeledBy (View label)

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 version 24.1.0
void setLabeledBy (View root, 
                int virtualDescendantId)

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 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 version 22.1.0
void setLiveRegion (int mode)

Sets the node's live region mode.

Note: Cannot be called from an 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 version 22.1.0
void setLongClickable (boolean longClickable)

Sets whether this node is long clickable.

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

Parameters
longClickable boolean: True if the node is long clickable.

Throws
IllegalStateException If called from an AccessibilityService.

setMaxTextLength

added in version 24.1.0
void setMaxTextLength (int max)

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 AccessibilityService. This class is made immutable before being delivered to an AccessibilityService.

Parameters
max int: The maximum text length.

Throws
IllegalStateException If called from an AccessibilityService.

See also:

setMovementGranularities

added in version 22.1.0
void setMovementGranularities (int granularities)

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

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

Parameters
granularities int: The bit mask with granularities.

Throws
IllegalStateException If called from an AccessibilityService.

setMultiLine

added in version 24.1.0
void setMultiLine (boolean multiLine)

Sets if the node is a multi line editable text.

Note: Cannot be called from an 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 version 22.1.0
void setPackageName (CharSequence packageName)

Sets the package this node comes from.

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

Parameters
packageName CharSequence: The package name.

Throws
IllegalStateException If called from an AccessibilityService.

setPaneTitle

void setPaneTitle (CharSequence paneTitle)

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 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 version 22.1.0
void setParent (View root, 
                int virtualDescendantId)

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

setParent

added in version 22.1.0
void setParent (View parent)

Sets the parent.

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

Parameters
parent View: The parent.

Throws
IllegalStateException If called from an AccessibilityService.

setPassword

added in version 22.1.0
void setPassword (boolean password)

Sets whether this node is a password.

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

Parameters
password boolean: True if the node is a password.

Throws
IllegalStateException If called from an AccessibilityService.

setRangeInfo

added in version 24.1.0
void setRangeInfo (AccessibilityNodeInfoCompat.RangeInfoCompat rangeInfo)

Sets the range info if this node is a range.

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

Parameters
rangeInfo AccessibilityNodeInfoCompat.RangeInfoCompat: The range info.

setRoleDescription

added in version 24.1.0
void setRoleDescription (CharSequence roleDescription)

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 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 CheckBox. Instead let accessibility services decide what feedback to provide.

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

Parameters
roleDescription CharSequence: The role description.

setScreenReaderFocusable

void setScreenReaderFocusable (boolean screenReaderFocusable)

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 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 version 22.1.0
void setScrollable (boolean scrollable)

Sets if the node is scrollable.

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

Parameters
scrollable boolean: True if the node is scrollable, false otherwise.

Throws
IllegalStateException If called from an AccessibilityService.

setSelected

added in version 22.1.0
void setSelected (boolean selected)

Sets whether this node is selected.

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

Parameters
selected boolean: True if the node is selected.

Throws
IllegalStateException If called from an AccessibilityService.

setShowingHintText

void setShowingHintText (boolean showingHintText)

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 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 version 22.1.0
void setSource (View source)

Sets the source.

Parameters
source View: The info source.

setSource

added in version 22.1.0
void setSource (View root, 
                int virtualDescendantId)

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

setText

added in version 22.1.0
void setText (CharSequence text)

Sets the text of this node.

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

Parameters
text CharSequence: The text.

Throws
IllegalStateException If called from an AccessibilityService.

setTextSelection

added in version 24.1.0
void setTextSelection (int start, 
                int end)

Sets the text selection start and end.

Note: Cannot be called from an 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
IllegalStateException If called from an AccessibilityService.

setTooltipText

void setTooltipText (CharSequence tooltipText)

Sets the tooltip text of this node.

This method has no effect below API 19

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

Parameters
tooltipText CharSequence: The tooltip text.

Throws
IllegalStateException If called from an AccessibilityService.

setTraversalAfter

added in version 24.1.0
void setTraversalAfter (View view)

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 AccessibilityService. This class is made immutable before being delivered to an AccessibilityService.

Parameters
view View: The previous view.

setTraversalAfter

added in version 24.1.0
void setTraversalAfter (View root, 
                int virtualDescendantId)

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 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 version 24.1.0
void setTraversalBefore (View view)

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 AccessibilityService. This class is made immutable before being delivered to an AccessibilityService.

Parameters
view View: The view providing the preceding node.

setTraversalBefore

added in version 24.1.0
void setTraversalBefore (View root, 
                int virtualDescendantId)

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

setViewIdResourceName

added in version 22.1.0
void setViewIdResourceName (String viewId)

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

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

Parameters
viewId String: The id resource name.

setVisibleToUser

added in version 22.1.0
void setVisibleToUser (boolean visibleToUser)

Sets whether this node is visible to the user.

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

Parameters
visibleToUser boolean: Whether the node is visible to the user.

Throws
IllegalStateException If called from an AccessibilityService.

toString

String toString ()

Returns
String

unwrap

added in version 26.1.0
AccessibilityNodeInfo unwrap ()

Returns
AccessibilityNodeInfo The unwrapped AccessibilityNodeInfo.

wrap

added in version 26.1.0
AccessibilityNodeInfoCompat wrap (AccessibilityNodeInfo info)

Creates a new instance wrapping an AccessibilityNodeInfo.

Parameters
info AccessibilityNodeInfo: The info.

Returns
AccessibilityNodeInfoCompat