Skip to content

Most visited

Recently visited

navigation
Added in API level 14

AccessibilityNodeInfo

public class AccessibilityNodeInfo
extends Object implements Parcelable

java.lang.Object
   ↳ android.view.accessibility.AccessibilityNodeInfo


This class represents a node of the window content as well as actions that can be requested from its source. From the point of view of an AccessibilityService a window content is presented as tree of accessibility node info which may or may not map one-to-one to the view hierarchy. In other words, a custom view is free to report itself as a tree of accessibility node info.

Once an accessibility node info is delivered to an accessibility service it is made immutable and calling a state mutation method generates an error.

Please refer to AccessibilityService for details about how to obtain a handle to window content as a tree of accessibility node info as well as familiarizing with the security model.

Developer Guides

For more information about making applications accessible, read the Accessibility developer guide.

See also:

Summary

Nested classes

class AccessibilityNodeInfo.AccessibilityAction

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

class AccessibilityNodeInfo.CollectionInfo

Class with information if a node is a collection. 

class AccessibilityNodeInfo.CollectionItemInfo

Class with information if a node is a collection item. 

class AccessibilityNodeInfo.RangeInfo

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

int ACTION_CLEAR_ACCESSIBILITY_FOCUS

Action that clears accessibility focus of the node.

int ACTION_CLEAR_FOCUS

Action that clears input focus of the node.

int ACTION_CLEAR_SELECTION

Action that deselects 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 gives input focus to 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.

Inherited constants

From interface android.os.Parcelable

Fields

public static final Creator<AccessibilityNodeInfo> CREATOR

Public methods

void addAction(AccessibilityNodeInfo.AccessibilityAction action)

Adds an action that can be performed on the node.

void addAction(int action)

This method was deprecated in API level 21. This has been deprecated for addAction(AccessibilityAction)

void addChild(View child)

Adds a child.

void addChild(View root, int virtualDescendantId)

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

boolean canOpenPopup()

Gets if this node opens a popup or a dialog.

int describeContents()

Describe the kinds of special objects contained in this Parcelable's marshalled representation.

boolean equals(Object object)

Compares this instance with the specified object and indicates if they are equal.

List<AccessibilityNodeInfo> findAccessibilityNodeInfosByText(String text)

Finds AccessibilityNodeInfos by text.

List<AccessibilityNodeInfo> findAccessibilityNodeInfosByViewId(String viewId)

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

AccessibilityNodeInfo findFocus(int focus)

Find the view that has the specified focus type.

AccessibilityNodeInfo focusSearch(int direction)

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

List<AccessibilityNodeInfo.AccessibilityAction> getActionList()

Gets the actions that can be performed on the node.

int getActions()

This method was deprecated in API level 21. Use getActionList().

void getBoundsInParent(Rect outBounds)

Gets the node bounds in parent coordinates.

void getBoundsInScreen(Rect outBounds)

Gets the node bounds in screen coordinates.

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

AccessibilityNodeInfo.CollectionInfo getCollectionInfo()

Gets the collection info if the node is a collection.

AccessibilityNodeInfo.CollectionItemInfo getCollectionItemInfo()

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

CharSequence getContentDescription()

Gets the content description of this node.

CharSequence getError()

Gets the error text of this node.

Bundle getExtras()

Gets an optional bundle with extra data.

int getInputType()

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

AccessibilityNodeInfo getLabelFor()

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

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

AccessibilityNodeInfo getParent()

Gets the parent.

AccessibilityNodeInfo.RangeInfo getRangeInfo()

Gets the range info if this node is a range.

CharSequence getText()

Gets the text of this node.

int getTextSelectionEnd()

Gets the text selection end.

int getTextSelectionStart()

Gets the text selection start.

AccessibilityNodeInfo getTraversalAfter()

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

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

AccessibilityWindowInfo 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()

Returns an integer hash code for this object.

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 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 isScrollable()

Gets if the node is scrollable.

boolean isSelected()

Gets whether this node is selected.

boolean isVisibleToUser()

Gets whether this node is visible to the user.

static AccessibilityNodeInfo obtain(View root, int virtualDescendantId)

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

static AccessibilityNodeInfo obtain()

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

static AccessibilityNodeInfo obtain(View source)

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

static AccessibilityNodeInfo obtain(AccessibilityNodeInfo info)

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

boolean performAction(int action)

Performs an action on the node.

boolean performAction(int action, Bundle arguments)

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.

void removeAction(int action)

This method was deprecated in API level 21. Use removeAction(AccessibilityAction)

boolean removeAction(AccessibilityNodeInfo.AccessibilityAction 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(AccessibilityNodeInfo.CollectionInfo collectionInfo)

Sets the collection info if the node is a collection.

void setCollectionItemInfo(AccessibilityNodeInfo.CollectionItemInfo collectionItemInfo)

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

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 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 setInputType(int inputType)

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

void setLabelFor(View labeled)

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

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 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 setParent(View parent)

Sets the parent.

void setParent(View root, int virtualDescendantId)

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

void setPassword(boolean password)

Sets whether this node is a password.

void setRangeInfo(AccessibilityNodeInfo.RangeInfo rangeInfo)

Sets the range info if this node is a range.

void setScrollable(boolean scrollable)

Sets if the node is scrollable.

void setSelected(boolean selected)

Sets whether this node is selected.

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

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

Returns a string containing a concise, human-readable description of this object.

void writeToParcel(Parcel parcel, int flags)

Flatten this object in to a Parcel.

Note: After the instance is written to a parcel it is recycled.

Inherited methods

From class java.lang.Object
From interface android.os.Parcelable

Constants

ACTION_ACCESSIBILITY_FOCUS

Added in API level 16
int ACTION_ACCESSIBILITY_FOCUS

Action that gives accessibility focus to the node.

Constant Value: 64 (0x00000040)

ACTION_ARGUMENT_COLUMN_INT

Added in API level 23
String ACTION_ARGUMENT_COLUMN_INT

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

Type: int
Actions:

See also:

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

ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN

Added in API level 18
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:

See also:

Constant Value: "ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN"

ACTION_ARGUMENT_HTML_ELEMENT_STRING

Added in API level 16
String ACTION_ARGUMENT_HTML_ELEMENT_STRING

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

Type: String
Actions:

See also:

Constant Value: "ACTION_ARGUMENT_HTML_ELEMENT_STRING"

ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT

Added in API level 16
String ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT

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

Type: int
Actions:

See also:

Constant Value: "ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT"

ACTION_ARGUMENT_ROW_INT

Added in API level 23
String ACTION_ARGUMENT_ROW_INT

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

Type: int
Actions:

See also:

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

ACTION_ARGUMENT_SELECTION_END_INT

Added in API level 18
String ACTION_ARGUMENT_SELECTION_END_INT

Argument for specifying the selection end.

Type: int
Actions:

See also:

Constant Value: "ACTION_ARGUMENT_SELECTION_END_INT"

ACTION_ARGUMENT_SELECTION_START_INT

Added in API level 18
String ACTION_ARGUMENT_SELECTION_START_INT

Argument for specifying the selection start.

Type: int
Actions:

See also:

Constant Value: "ACTION_ARGUMENT_SELECTION_START_INT"

ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE

Added in API level 21
String ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE

Argument for specifying the text content to set.

Type: CharSequence
Actions:

See also:

Constant Value: "ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE"

ACTION_CLEAR_ACCESSIBILITY_FOCUS

Added in API level 16
int ACTION_CLEAR_ACCESSIBILITY_FOCUS

Action that clears accessibility focus of the node.

Constant Value: 128 (0x00000080)

ACTION_CLEAR_FOCUS

Added in API level 14
int ACTION_CLEAR_FOCUS

Action that clears input focus of the node.

Constant Value: 2 (0x00000002)

ACTION_CLEAR_SELECTION

Added in API level 14
int ACTION_CLEAR_SELECTION

Action that deselects the node.

Constant Value: 8 (0x00000008)

ACTION_CLICK

Added in API level 16
int ACTION_CLICK

Action that clicks on the node info.

Constant Value: 16 (0x00000010)

ACTION_COLLAPSE

Added in API level 19
int ACTION_COLLAPSE

Action to collapse an expandable node.

Constant Value: 524288 (0x00080000)

ACTION_COPY

Added in API level 18
int ACTION_COPY

Action to copy the current selection to the clipboard.

Constant Value: 16384 (0x00004000)

ACTION_CUT

Added in API level 18
int ACTION_CUT

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

Constant Value: 65536 (0x00010000)

ACTION_DISMISS

Added in API level 19
int ACTION_DISMISS

Action to dismiss a dismissable node.

Constant Value: 1048576 (0x00100000)

ACTION_EXPAND

Added in API level 19
int ACTION_EXPAND

Action to expand an expandable node.

Constant Value: 262144 (0x00040000)

ACTION_FOCUS

Added in API level 14
int ACTION_FOCUS

Action that gives input focus to the node.

Constant Value: 1 (0x00000001)

ACTION_LONG_CLICK

Added in API level 16
int ACTION_LONG_CLICK

Action that long clicks on the node.

Constant Value: 32 (0x00000020)

ACTION_NEXT_AT_MOVEMENT_GRANULARITY

Added in API level 16
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);

See also:

Constant Value: 256 (0x00000100)

ACTION_NEXT_HTML_ELEMENT

Added in API level 16
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 API level 18
int ACTION_PASTE

Action to paste the current clipboard content.

Constant Value: 32768 (0x00008000)

ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY

Added in API level 16
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);

See also:

Constant Value: 512 (0x00000200)

ACTION_PREVIOUS_HTML_ELEMENT

Added in API level 16
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 API level 16
int ACTION_SCROLL_BACKWARD

Action to scroll the node content backward.

Constant Value: 8192 (0x00002000)

ACTION_SCROLL_FORWARD

Added in API level 16
int ACTION_SCROLL_FORWARD

Action to scroll the node content forward.

Constant Value: 4096 (0x00001000)

ACTION_SELECT

Added in API level 14
int ACTION_SELECT

Action that selects the node.

Constant Value: 4 (0x00000004)

ACTION_SET_SELECTION

Added in API level 18
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);

See also:

Constant Value: 131072 (0x00020000)

ACTION_SET_TEXT

Added in API level 21
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 API level 16
int FOCUS_ACCESSIBILITY

The accessibility focus.

Constant Value: 2 (0x00000002)

FOCUS_INPUT

Added in API level 16
int FOCUS_INPUT

The input focus.

Constant Value: 1 (0x00000001)

MOVEMENT_GRANULARITY_CHARACTER

Added in API level 16
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 API level 16
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 API level 16
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 API level 16
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 API level 16
int MOVEMENT_GRANULARITY_WORD

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

Constant Value: 2 (0x00000002)

Fields

CREATOR

Added in API level 14
Creator<AccessibilityNodeInfo> CREATOR

See also:

Public methods

addAction

Added in API level 21
void addAction (AccessibilityNodeInfo.AccessibilityAction action)

Adds an action that can be performed on the node.

To add a standard action use the static constants on AccessibilityNodeInfo.AccessibilityAction. To add a custom action create a new AccessibilityNodeInfo.AccessibilityAction by passing in a resource id from your application as the action id and an optional label that describes the action. To override one of the standard actions use as the action id of a standard action id such as ACTION_CLICK and an optional label that describes the action.

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

Parameters
action AccessibilityNodeInfo.AccessibilityAction: The action.
Throws
IllegalStateException If called from an AccessibilityService.

addAction

Added in API level 14
void addAction (int action)

This method was deprecated in API level 21.
This has been deprecated for addAction(AccessibilityAction)

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.
IllegalArgumentException If the argument is not one of the standard actions.

addChild

Added in API level 14
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.

addChild

Added in API level 16
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.

canOpenPopup

Added in API level 19
boolean canOpenPopup ()

Gets if this node opens a popup or a dialog.

Returns
boolean If the the node opens a popup.

describeContents

Added in API level 14
int describeContents ()

Describe the kinds of special objects contained in this Parcelable's marshalled representation.

Returns
int a bitmask indicating the set of special object types marshalled by the Parcelable.

equals

Added in API level 14
boolean equals (Object object)

Compares this instance with the specified object and indicates if they are equal. In order to be equal, o must represent the same object as this instance using a class-specific comparison. The general contract is that this comparison should be reflexive, symmetric, and transitive. Also, no object reference other than null is equal to null.

The default implementation returns true only if this == o. See Writing a correct equals method if you intend implementing your own equals method.

The general contract for the equals and hashCode() methods is that if equals returns true for any two objects, then hashCode() must return the same value for these objects. This means that subclasses of Object usually override either both methods or neither of them.

Parameters
object Object: the object to compare this instance with.
Returns
boolean true if the specified object is equal to this Object; false otherwise.

findAccessibilityNodeInfosByText

Added in API level 14
List<AccessibilityNodeInfo> 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<AccessibilityNodeInfo> A list of node info.

findAccessibilityNodeInfosByViewId

Added in API level 18
List<AccessibilityNodeInfo> findAccessibilityNodeInfosByViewId (String viewId)

Finds AccessibilityNodeInfos 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 AccessibilityNodeInfo the client has to set the FLAG_REPORT_VIEW_IDS flag when configuring his AccessibilityService.

Parameters
viewId String: The fully qualified resource name of the view id to find.
Returns
List<AccessibilityNodeInfo> A list of node info.

findFocus

Added in API level 16
AccessibilityNodeInfo 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
AccessibilityNodeInfo The node info of the focused view or null.

See also:

focusSearch

Added in API level 16
AccessibilityNodeInfo focusSearch (int direction)

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

Parameters
direction int: The direction. Can be one of: FOCUS_DOWN, FOCUS_UP, FOCUS_LEFT, FOCUS_RIGHT, FOCUS_FORWARD, FOCUS_BACKWARD.
Returns
AccessibilityNodeInfo The node info for the view that can take accessibility focus.

getActionList

Added in API level 21
List<AccessibilityNodeInfo.AccessibilityAction> getActionList ()

Gets the actions that can be performed on the node.

Returns
List<AccessibilityNodeInfo.AccessibilityAction>

getBoundsInParent

Added in API level 14
void getBoundsInParent (Rect outBounds)

Gets the node bounds in parent coordinates.

Parameters
outBounds Rect: The output node bounds.

getBoundsInScreen

Added in API level 14
void getBoundsInScreen (Rect outBounds)

Gets the node bounds in screen coordinates.

Parameters
outBounds Rect: The output node bounds.

getChild

Added in API level 14
AccessibilityNodeInfo 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
AccessibilityNodeInfo The child node.
Throws
IllegalStateException If called outside of an AccessibilityService.

getChildCount

Added in API level 14
int getChildCount ()

Gets the number of children.

Returns
int The child count.

getClassName

Added in API level 14
CharSequence getClassName ()

Gets the class this node comes from.

Returns
CharSequence The class name.

getCollectionInfo

Added in API level 19
AccessibilityNodeInfo.CollectionInfo getCollectionInfo ()

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

Returns
AccessibilityNodeInfo.CollectionInfo The collection info.

getCollectionItemInfo

Added in API level 19
AccessibilityNodeInfo.CollectionItemInfo getCollectionItemInfo ()

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

Returns
AccessibilityNodeInfo.CollectionItemInfo The collection item info.

getContentDescription

Added in API level 14
CharSequence getContentDescription ()

Gets the content description of this node.

Returns
CharSequence The content description.

getError

Added in API level 21
CharSequence getError ()

Gets the error text of this node.

Returns
CharSequence The error text.

getExtras

Added in API level 19
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.

getInputType

Added in API level 19
int getInputType ()

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

Returns
int The input type.

getLabelFor

Added in API level 17
AccessibilityNodeInfo 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
AccessibilityNodeInfo The labeled info.

getLabeledBy

Added in API level 17
AccessibilityNodeInfo 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
AccessibilityNodeInfo The label.

getLiveRegion

Added in API level 19
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.

See also:

getMaxTextLength

Added in API level 21
int getMaxTextLength ()

Returns the maximum text length for this node.

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

See also:

getMovementGranularities

Added in API level 16
int getMovementGranularities ()

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

Returns
int The bit mask with granularities.

getPackageName

Added in API level 14
CharSequence getPackageName ()

Gets the package this node comes from.

Returns
CharSequence The package name.

getParent

Added in API level 14
AccessibilityNodeInfo 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
AccessibilityNodeInfo The parent.

getRangeInfo

Added in API level 19
AccessibilityNodeInfo.RangeInfo getRangeInfo ()

Gets the range info if this node is a range.

Returns
AccessibilityNodeInfo.RangeInfo The range.

getText

Added in API level 14
CharSequence getText ()

Gets the text of this node.

Returns
CharSequence The text.

getTextSelectionEnd

Added in API level 18
int getTextSelectionEnd ()

Gets the text selection end.

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

getTextSelectionStart

Added in API level 18
int getTextSelectionStart ()

Gets the text selection start.

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

getTraversalAfter

Added in API level 22
AccessibilityNodeInfo 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
AccessibilityNodeInfo The succeeding node if such or null.

See also:

getTraversalBefore

Added in API level 22
AccessibilityNodeInfo 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
AccessibilityNodeInfo The succeeding node if such or null.

See also:

getViewIdResourceName

Added in API level 18
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 AccessibilityNodeInfo the client has to set the FLAG_REPORT_VIEW_IDS flag when configuring his AccessibilityService.

Returns
String The id resource name.

getWindow

Added in API level 21
AccessibilityWindowInfo getWindow ()

Gets the window to which this node belongs.

Returns
AccessibilityWindowInfo The window.

See also:

getWindowId

Added in API level 14
int getWindowId ()

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

Returns
int The window id.

hashCode

Added in API level 14
int hashCode ()

Returns an integer hash code for this object. By contract, any two objects for which equals(Object) returns true must return the same hash code value. This means that subclasses of Object usually override both methods or neither method.

Note that hash values must not change over time unless information used in equals comparisons also changes.

See Writing a correct hashCode method if you intend implementing your own hashCode method.

Returns
int this object's hash code.

isAccessibilityFocused

Added in API level 16
boolean isAccessibilityFocused ()

Gets whether this node is accessibility focused.

Returns
boolean True if the node is accessibility focused.

isCheckable

Added in API level 14
boolean isCheckable ()

Gets whether this node is checkable.

Returns
boolean True if the node is checkable.

isChecked

Added in API level 14
boolean isChecked ()

Gets whether this node is checked.

Returns
boolean True if the node is checked.

isClickable

Added in API level 14
boolean isClickable ()

Gets whether this node is clickable.

Returns
boolean True if the node is clickable.

isContentInvalid

Added in API level 19
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 API level 23
boolean isContextClickable ()

Gets whether this node is context clickable.

Returns
boolean True if the node is context clickable.

isDismissable

Added in API level 19
boolean isDismissable ()

Gets if the node can be dismissed.

Returns
boolean If the node can be dismissed.

isEditable

Added in API level 18
boolean isEditable ()

Gets if the node is editable.

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

isEnabled

Added in API level 14
boolean isEnabled ()

Gets whether this node is enabled.

Returns
boolean True if the node is enabled.

isFocusable

Added in API level 14
boolean isFocusable ()

Gets whether this node is focusable.

Returns
boolean True if the node is focusable.

isFocused

Added in API level 14
boolean isFocused ()

Gets whether this node is focused.

Returns
boolean True if the node is focused.

isLongClickable

Added in API level 14
boolean isLongClickable ()

Gets whether this node is long clickable.

Returns
boolean True if the node is long clickable.

isMultiLine

Added in API level 19
boolean isMultiLine ()

Gets if the node is a multi line editable text.

Returns
boolean True if the node is multi line.

isPassword

Added in API level 14
boolean isPassword ()

Gets whether this node is a password.

Returns
boolean True if the node is a password.

isScrollable

Added in API level 14
boolean isScrollable ()

Gets if the node is scrollable.

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

isSelected

Added in API level 14
boolean isSelected ()

Gets whether this node is selected.

Returns
boolean True if the node is selected.

isVisibleToUser

Added in API level 16
boolean isVisibleToUser ()

Gets whether this node is visible to the user.

Returns
boolean Whether the node is visible to the user.

obtain

Added in API level 16
AccessibilityNodeInfo 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
AccessibilityNodeInfo An instance.

See also:

obtain

Added in API level 14
AccessibilityNodeInfo obtain ()

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

Returns
AccessibilityNodeInfo An instance.

obtain

Added in API level 14
AccessibilityNodeInfo obtain (View source)

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

Parameters
source View: The source view.
Returns
AccessibilityNodeInfo An instance.

See also:

obtain

Added in API level 14
AccessibilityNodeInfo obtain (AccessibilityNodeInfo 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 AccessibilityNodeInfo: The other info.
Returns
AccessibilityNodeInfo An instance.

performAction

Added in API level 14
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.

performAction

Added in API level 16
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.

recycle

Added in API level 14
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 API level 18
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 API level 21
void removeAction (int action)

This method was deprecated in API level 21.
Use removeAction(AccessibilityAction)

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 int: The action to be removed.
Throws
IllegalStateException If called from an AccessibilityService.

removeAction

Added in API level 21
boolean removeAction (AccessibilityNodeInfo.AccessibilityAction 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 AccessibilityNodeInfo.AccessibilityAction: 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 API level 21
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

See also:

removeChild

Added in API level 21
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 API level 16
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 API level 14
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 API level 14
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 API level 19
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 API level 14
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 API level 14
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 API level 14
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 API level 14
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 API level 19
void setCollectionInfo (AccessibilityNodeInfo.CollectionInfo collectionInfo)

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

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

Parameters
collectionInfo AccessibilityNodeInfo.CollectionInfo: The collection info.

setCollectionItemInfo

Added in API level 19
void setCollectionItemInfo (AccessibilityNodeInfo.CollectionItemInfo collectionItemInfo)

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

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

Parameters
collectionItemInfo AccessibilityNodeInfo.CollectionItemInfo

setContentDescription

Added in API level 14
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 API level 19
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 API level 23
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 API level 19
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.

setEditable

Added in API level 18
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 API level 14
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 API level 21
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 API level 14
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 API level 14
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.

setInputType

Added in API level 19
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 API level 17
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.

setLabelFor

Added in API level 17
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.

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 serves as a label.
virtualDescendantId int: The id of the virtual descendant.

setLabeledBy

Added in API level 17
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 API level 17
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 API level 19
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.

See also:

setLongClickable

Added in API level 14
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 API level 21
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 API level 16
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 API level 19
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 API level 14
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.

setParent

Added in API level 14
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.

setParent

Added in API level 16
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.

setPassword

Added in API level 14
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 API level 19
void setRangeInfo (AccessibilityNodeInfo.RangeInfo 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 AccessibilityNodeInfo.RangeInfo: The range info.

setScrollable

Added in API level 14
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 API level 14
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.

setSource

Added in API level 14
void setSource (View source)

Sets the source.

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

Parameters
source View: The info source.

setSource

Added in API level 16
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 API level 14
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 API level 18
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.

setTraversalAfter

Added in API level 22
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.

See also:

setTraversalAfter

Added in API level 22
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 API level 22
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.

See also:

setTraversalBefore

Added in API level 22
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 API level 18
void setViewIdResourceName (String viewIdResName)

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
viewIdResName String: The id resource name.

setVisibleToUser

Added in API level 16
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

Added in API level 14
String toString ()

Returns a string containing a concise, human-readable description of this object. Subclasses are encouraged to override this method and provide an implementation that takes into account the object's type and data. The default implementation is equivalent to the following expression:

   getClass().getName() + '@' + Integer.toHexString(hashCode())

See Writing a useful toString method if you intend implementing your own toString method.

Returns
String a printable representation of this object.

writeToParcel

Added in API level 14
void writeToParcel (Parcel parcel, 
                int flags)

Flatten this object in to a Parcel.

Note: After the instance is written to a parcel it is recycled. You must not touch the object after calling this function.

Parameters
parcel Parcel: The Parcel in which the object should be written.
flags int: Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE.
This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.