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's content is
presented as a tree of accessibility node infos, 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. See
setQueryFromAppProcessEnabled(View, boolean) if you would like to inspect the
node tree from the app process for testing or debugging tools.
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 details about the security model.
For more information about making applications accessible, read the Accessibility developer guide.
Nested classes | |
|---|---|
class |
AccessibilityNodeInfo.AccessibilityAction
A class defining an action that can be performed on an |
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.ExtraRenderingInfo
Class with information of a view useful to evaluate accessibility needs. |
class |
AccessibilityNodeInfo.MathInfo
A class that holds information about a node that represents a mathematical expression. |
class |
AccessibilityNodeInfo.RangeInfo
Class with information if a node is a range. |
class |
AccessibilityNodeInfo.Selection
Represents a selection of content that may extend across more than one |
class |
AccessibilityNodeInfo.SelectionPosition
A class which defines either the start or end of a selection that can span across multiple AccessibilityNodeInfo objects. |
class |
AccessibilityNodeInfo.StructuredDataInfo
An abstract base class for holding structured semantic information about a node. |
class |
AccessibilityNodeInfo.TouchDelegateInfo
Class with information of touch delegated views and regions from |
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_DIRECTION_INT
Argument to represent the direction when using
|
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_PRESS_AND_HOLD_DURATION_MILLIS_INT
Argument to represent the duration in milliseconds to press and hold a node. |
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_SCROLL_AMOUNT_FLOAT
Argument to represent the scroll amount as a percent of the visible area of a node, with 1.0F as the default. |
String |
ACTION_ARGUMENT_SELECTION_END_INT
Argument for specifying the selection end. |
String |
ACTION_ARGUMENT_SELECTION_PARCELABLE
Argument for specifying the extended selection. |
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 |
CHECKED_STATE_FALSE
This node is not checked. |
int |
CHECKED_STATE_PARTIAL
This node is partially checked. |
int |
CHECKED_STATE_TRUE
This node is checked. |
int |
EXPANDED_STATE_COLLAPSED
Expanded state for a collapsed expandable element. |
int |
EXPANDED_STATE_FULL
Expanded state for a expanded expandable element that cannot be expanded further. |
int |
EXPANDED_STATE_PARTIAL
Expanded state for an expanded expandable element that can still be expanded further. |
int |
EXPANDED_STATE_UNDEFINED
Expanded state for a non-expandable element |
String |
EXTRA_DATA_RENDERING_INFO_KEY
Key used to request extra data for the rendering information. |
String |
EXTRA_DATA_REQUEST_LAYOUT_BASED_ACTIONS_KEY
Key used to request that the node source re-evaluate and update this node's layout-dependent actions. |
String |
EXTRA_DATA_TEXT_CHARACTER_LOCATION_ARG_LENGTH
Integer argument specifying the end index of the requested text location data. |
int |
EXTRA_DATA_TEXT_CHARACTER_LOCATION_ARG_MAX_LENGTH
The maximum allowed length of the requested text location data. |
String |
EXTRA_DATA_TEXT_CHARACTER_LOCATION_ARG_START_INDEX
Integer argument specifying the start index of the requested text location data. |
String |
EXTRA_DATA_TEXT_CHARACTER_LOCATION_IN_WINDOW_KEY
Key used to request and locate extra data for text character location in window coordinates. |
String |
EXTRA_DATA_TEXT_CHARACTER_LOCATION_KEY
Key used to request and locate extra data for text character location. |
int |
FLAG_PREFETCH_ANCESTORS
Prefetching strategy that prefetches the ancestors of the requested node. |
int |
FLAG_PREFETCH_DESCENDANTS_BREADTH_FIRST
Prefetching strategy that prefetches the descendants of the requested node breadth-first. |
int |
FLAG_PREFETCH_DESCENDANTS_DEPTH_FIRST
Prefetching strategy that prefetches the descendants of the requested node depth-first. |
int |
FLAG_PREFETCH_DESCENDANTS_HYBRID
Prefetching strategy that prefetches the descendants in a hybrid depth first and breadth first approach. |
int |
FLAG_PREFETCH_SIBLINGS
Prefetching strategy that prefetches the siblings of the requested node. |
int |
FLAG_PREFETCH_UNINTERRUPTIBLE
Prefetching flag that specifies prefetching should not be interrupted by a request to retrieve a node or perform an action on a node. |
int |
FOCUS_ACCESSIBILITY
The accessibility focus. |
int |
FOCUS_INPUT
The input focus. |
int |
MAX_NUMBER_OF_PREFETCHED_NODES
Maximum batch size of prefetched nodes for a request. |
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 |
|---|
Fields | |
|---|---|
public
static
final
Creator<AccessibilityNodeInfo> |
CREATOR
|
Public constructors | |
|---|---|
AccessibilityNodeInfo()
Creates a new |
|
AccessibilityNodeInfo(AccessibilityNodeInfo info)
Copy constructor. |
|
AccessibilityNodeInfo(View source)
Creates a new |
|
AccessibilityNodeInfo(View root, int virtualDescendantId)
Creates a new |
|
void
addAction(int action)
This method was deprecated
in API level 21.
This has been deprecated for addAction(AccessibilityAction)
void
addAction(AccessibilityNodeInfo.AccessibilityAction 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.
void
addLabeledBy(View label)
Adds the view which serves as the label of the view represented by this info for accessibility purposes.
void
addLabeledBy(View root, int virtualDescendantId)
Adds the view which serves as the label of the view represented by this info for accessibility purposes.
boolean
canOpenPopup()
Gets if this node opens a popup or a dialog.
int
describeContents()
Describe the kinds of special objects contained in this Parcelable instance's marshaled representation.
boolean
equals(Object object)
Indicates whether some other object is "equal to" this one.
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().
List<String>
getAvailableExtraData()
Get the extra data available for this node.
void
getBoundsInParent(Rect outBounds)
This method was deprecated
in API level 29.
Use getBoundsInScreen(Rect) instead.
void
getBoundsInScreen(Rect outBounds)
Gets the node bounds in screen coordinates.
void
getBoundsInWindow(Rect outBounds)
Gets the node bounds in window coordinates.
int
getChecked()
Gets the checked state of this node.
AccessibilityNodeInfo
getChild(int index)
Get the child at given index.
AccessibilityNodeInfo
getChild(int index, int prefetchingStrategy)
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
getContainerTitle()
Returns the container title.
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.
int
getExpandedState()
Gets the expanded state for this node.
AccessibilityNodeInfo.ExtraRenderingInfo
getExtraRenderingInfo()
Gets the extra rendering info if the node is meant to be
refreshed with extra data to examine rendering related accessibility issues.
Bundle
getExtras()
Gets an optional bundle with extra data.
CharSequence
getHintText()
Gets the hint text of this node.
int
getInputType()
Gets the input type of the source as defined by InputType.
AccessibilityNodeInfo
getLabelFor()
This method was deprecated
in API level 36.
Use getLabeledByList() on the labeled node instead,
since calling addLabeledBy(View) or addLabeledBy(View,int)
on the labeled node do not automatically provide that node from this method.
AccessibilityNodeInfo
getLabeledBy()
This method was deprecated
in API level 36.
Use getLabeledByList() instead.
List<AccessibilityNodeInfo>
getLabeledByList()
Gets the list of node infos which serve as the labels 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.
Duration
getMinDurationBetweenContentChanges()
Gets the minimum time duration between two content change events.
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.
AccessibilityNodeInfo
getParent()
Gets the parent.
AccessibilityNodeInfo
getParent(int prefetchingStrategy)
Gets the parent.
AccessibilityNodeInfo.RangeInfo
getRangeInfo()
Gets the range info if this node is a range.
AccessibilityNodeInfo.Selection
getSelection()
Gets the extended selection, which is a representation of selection that spans multiple nodes that exist within the subtree of the node defining selection.
CharSequence
getStateDescription()
Get the state description of this node.
AccessibilityNodeInfo.StructuredDataInfo
getStructuredDataInfo()
Gets additional structured data properties of this node.
CharSequence
getSupplementalDescription()
Gets the supplemental description of this node.
CharSequence
getText()
Gets the text of this node.
int
getTextSelectionEnd()
Gets the text selection end if text is selected.
int
getTextSelectionStart()
Gets the text selection start or the cursor position.
CharSequence
getTooltipText()
Gets the tooltip text of this node.
AccessibilityNodeInfo.TouchDelegateInfo
getTouchDelegateInfo()
Get the TouchDelegateInfo for touch delegate behavior with the represented view.
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
getUniqueId()
Gets the unique id of the node.
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()
Returns the id of the window that created this node.
boolean
hasRequestInitialAccessibilityFocus()
Gets whether the node has setRequestInitialAccessibilityFocus(boolean).
int
hashCode()
Returns a hash code value for the object.
boolean
isAccessibilityDataSensitive()
Gets if the node's accessibility data is considered sensitive.
boolean
isAccessibilityFocused()
Gets whether this node is accessibility focused.
boolean
isCheckable()
Gets whether this node is checkable.
boolean
isChecked()
This method was deprecated
in API level 36.
Use getChecked() instead.
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
isFieldRequired()
Gets whether a node representing a form field requires input or selection.
boolean
isFocusable()
Gets whether this node is focusable.
boolean
isFocused()
Gets whether this node is focused.
boolean
isGranularScrollingSupported()
Gets if the node supports granular scrolling.
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
isTextEntryKey()
Returns whether node represents a text entry key that is part of a keyboard or keypad.
boolean
isTextSelectable()
Gets if the node has selectable text.
boolean
isVisibleToUser()
Gets whether this node is visible to the user.
static
AccessibilityNodeInfo
obtain(View root, int virtualDescendantId)
This method was deprecated
in API level 33.
Object pooling has been discontinued. Create a new instance using the
constructor AccessibilityNodeInfo(View,int) instead.
static
AccessibilityNodeInfo
obtain(AccessibilityNodeInfo info)
This method was deprecated
in API level 33.
Object pooling has been discontinued. Create a new instance using the
constructor AccessibilityNodeInfo(AccessibilityNodeInfo) instead.
static
AccessibilityNodeInfo
obtain()
This method was deprecated
in API level 33.
Object pooling has been discontinued. Create a new instance using the
constructor AccessibilityNodeInfo() instead.
static
AccessibilityNodeInfo
obtain(View source)
This method was deprecated
in API level 33.
Object pooling has been discontinued. Create a new instance using the
constructor AccessibilityNodeInfo(View) instead.
boolean
performAction(int action, Bundle arguments)
Performs an action on the node.
boolean
performAction(int action)
Performs an action on the node.
void
recycle()
This method was deprecated in API level 33. Object pooling has been discontinued. Calling this function now will have no effect.
boolean
refresh()
Refreshes this info with the latest state of the view it represents.
boolean
refreshWithExtraData(String extraDataKey, Bundle args)
Refreshes this info with the latest state of the view it represents, and request new data be added by the View.
boolean
removeAction(AccessibilityNodeInfo.AccessibilityAction action)
Removes an action that can be performed on the node.
void
removeAction(int action)
This method was deprecated
in API level 21.
Use removeAction(AccessibilityAction)
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.
boolean
removeLabeledBy(View root, int virtualDescendantId)
Removes a label which is a virtual descendant of the given
root.
boolean
removeLabeledBy(View label)
Removes a label.
void
setAccessibilityDataSensitive(boolean accessibilityDataSensitive)
Sets whether this node's accessibility data is considered sensitive.
void
setAccessibilityFocused(boolean focused)
Sets whether this node is accessibility focused.
void
setAvailableExtraData(List<String> extraDataKeys)
Set the extra data available for this node.
void
setBoundsInParent(Rect bounds)
This method was deprecated in API level 29. Accessibility services should not care about these bounds.
void
setBoundsInScreen(Rect bounds)
Sets the node bounds in screen coordinates.
void
setBoundsInWindow(Rect bounds)
Sets the node bounds in window 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)
This method was deprecated
in API level 36.
Use setChecked(int) instead.
void
setChecked(int checked)
Sets the checked state of this node.
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
setContainerTitle(CharSequence containerTitle)
Sets the container title for app-developer-defined container which can be any type of ViewGroup or layout.
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
setExpandedState(int state)
Sets the expanded state of the node.
void
setExtraRenderingInfo(AccessibilityNodeInfo.ExtraRenderingInfo extraRenderingInfo)
Sets the extra rendering info, extraRenderingInfo, if the node is meant to be
refreshed with extra data.
void
setFieldRequired(boolean required)
Sets whether this node represents a form field that requires input or selection.
void
setFocusable(boolean focusable)
Sets whether this node is focusable.
void
setFocused(boolean focused)
Sets whether this node is focused.
void
setGranularScrollingSupported(boolean granularScrollingSupported)
Sets if the node supports granular scrolling.
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)
This method was deprecated
in API level 36.
Use addLabeledBy(View) on the labeled node instead,
since getLabeledByList() and getLabeledBy() on the
labeled node are not automatically populated when this method is used.
void
setLabelFor(View labeled)
This method was deprecated
in API level 36.
Use addLabeledBy(View) on the labeled node instead,
since getLabeledByList() and getLabeledBy() on the
labeled node are not automatically populated when this method is used.
void
setLabeledBy(View label)
This method was deprecated
in API level 36.
Use addLabeledBy(View) or removeLabeledBy(View) instead.
void
setLabeledBy(View root, int virtualDescendantId)
This method was deprecated
in API level 36.
Use addLabeledBy(View,int) or removeLabeledBy(View,int)
instead.
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
setMinDurationBetweenContentChanges(Duration duration)
Sets the minimum time duration between two content change events, which is used in throttling
content change events in accessibility services.
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
setQueryFromAppProcessEnabled(View view, boolean enabled)
Connects this node to the View's root so that operations on this node can query the entire
AccessibilityNodeInfo tree and perform accessibility actions on nodes.
void
setRangeInfo(AccessibilityNodeInfo.RangeInfo rangeInfo)
Sets the range info if this node is a range.
void
setRequestInitialAccessibilityFocus(boolean requestInitialAccessibilityFocus)
Sets whether the node has requested initial accessibility focus.
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
setSelection(AccessibilityNodeInfo.Selection selection)
Sets the extended selection, which is a representation of selection that spans multiple nodes
that exist within the subtree of the node defining selection.
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
setStateDescription(CharSequence stateDescription)
Sets the state description of this node.
void
setStructuredDataInfo(AccessibilityNodeInfo.StructuredDataInfo info)
Sets additional structured data properties of this node, such as for a mathematical
expression.
void
setSupplementalDescription(CharSequence supplementalDescription)
Sets the supplemental description of this node.
void
setText(CharSequence text)
Sets the text of this node.
void
setTextEntryKey(boolean isTextEntryKey)
Sets whether the node represents a text entry key that is part of a keyboard or keypad.
void
setTextSelectable(boolean selectableText)
Sets if the node has selectable text.
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
setTouchDelegateInfo(AccessibilityNodeInfo.TouchDelegateInfo delegatedInfo)
Set touch delegate info if the represented view has a TouchDelegate.
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
setUniqueId(String uniqueId)
Sets the unique id to act as a key to identify the node.
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 representation of the 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
Constants
ACTION_ACCESSIBILITY_FOCUS
Added in API level 16
public static final int ACTION_ACCESSIBILITY_FOCUS
Action that gives accessibility focus to the node.
See AccessibilityAction.ACTION_ACCESSIBILITY_FOCUS
Constant Value:
64
(0x00000040)
ACTION_ARGUMENT_COLUMN_INT
Added in API level 23
public static final 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_DIRECTION_INT
Added in API level 34
public static final String ACTION_ARGUMENT_DIRECTION_INT
Argument to represent the direction when using
AccessibilityAction.ACTION_SCROLL_IN_DIRECTION.
The value of this argument can be one of:
View.FOCUS_DOWN
View.FOCUS_UP
View.FOCUS_LEFT
View.FOCUS_RIGHT
View.FOCUS_FORWARD
View.FOCUS_BACKWARD
Constant Value:
"android.view.accessibility.action.ARGUMENT_DIRECTION_INT"
ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN
Added in API level 18
public static final 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:
AccessibilityAction.ACTION_NEXT_AT_MOVEMENT_GRANULARITY
AccessibilityAction.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY
See also:
Constant Value:
"ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN"
ACTION_ARGUMENT_HTML_ELEMENT_STRING
Added in API level 16
public static final 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
public static final String ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT
Argument for which movement granularity to be used when traversing the node text.
Type: int
Actions:
AccessibilityAction.ACTION_NEXT_AT_MOVEMENT_GRANULARITY
AccessibilityAction.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY
See also:
Constant Value:
"ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT"
ACTION_ARGUMENT_MOVE_WINDOW_X
Added in API level 26
public static final 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
Added in API level 26
public static final 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_PRESS_AND_HOLD_DURATION_MILLIS_INT
Added in API level 30
public static final String ACTION_ARGUMENT_PRESS_AND_HOLD_DURATION_MILLIS_INT
Argument to represent the duration in milliseconds to press and hold a node.
Type: int
Actions:
Constant Value:
"android.view.accessibility.action.ARGUMENT_PRESS_AND_HOLD_DURATION_MILLIS_INT"
ACTION_ARGUMENT_PROGRESS_VALUE
Added in API level 24
public static final String ACTION_ARGUMENT_PROGRESS_VALUE
Argument for specifying the progress value to set.
Type: float
Actions:
See also:
Constant Value:
"android.view.accessibility.action.ARGUMENT_PROGRESS_VALUE"
ACTION_ARGUMENT_ROW_INT
Added in API level 23
public static final 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_SCROLL_AMOUNT_FLOAT
Added in API level 35
public static final String ACTION_ARGUMENT_SCROLL_AMOUNT_FLOAT
Argument to represent the scroll amount as a percent of the visible area of a node, with
1.0F as the default. Values smaller than 1.0F represent a partial scroll of the node, and
values larger than 1.0F represent a scroll that extends beyond the currently visible node
Rect. Setting this to Float.POSITIVE_INFINITY or to another "too large" value should
scroll to the end of the node. Negative values should not be used with this argument.
This argument should be used with the following scroll actions:
AccessibilityAction.ACTION_SCROLL_FORWARD
AccessibilityAction.ACTION_SCROLL_BACKWARD
AccessibilityAction.ACTION_SCROLL_UP
AccessibilityAction.ACTION_SCROLL_DOWN
AccessibilityAction.ACTION_SCROLL_LEFT
AccessibilityAction.ACTION_SCROLL_RIGHT
Example: if a view representing a list of items implements
AccessibilityAction.ACTION_SCROLL_FORWARD to scroll forward by an entire screen
(one "page"), then passing a value of .25F via this argument should scroll that view
only by 1/4th of a screen. Passing a value of 1.50F via this argument should scroll the
view by 1 1/2 screens or to end of the node if the node doesn't extend to 1 1/2 screens.
This argument should not be used with the following scroll actions, which don't cleanly
conform to granular scroll semantics:
Views that support this argument should set
setGranularScrollingSupported(boolean) to true. Clients should use
isGranularScrollingSupported() to check if granular scrolling is supported.
Constant Value:
"android.view.accessibility.action.ARGUMENT_SCROLL_AMOUNT_FLOAT"
ACTION_ARGUMENT_SELECTION_END_INT
Added in API level 18
public static final 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_PARCELABLE
Added in version 36.1
public static final String ACTION_ARGUMENT_SELECTION_PARCELABLE
Argument for specifying the extended selection.
Type: AccessibilityNodeInfo.Selection
Actions:
Constant Value:
"android.view.accessibility.action.ARGUMENT_SELECTION_PARCELABLE"
ACTION_ARGUMENT_SELECTION_START_INT
Added in API level 18
public static final 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
public static final 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
public static final int ACTION_CLEAR_ACCESSIBILITY_FOCUS
Action that clears accessibility focus of the node.
See AccessibilityAction.ACTION_CLEAR_ACCESSIBILITY_FOCUS
Constant Value:
128
(0x00000080)
ACTION_CLEAR_FOCUS
Added in API level 14
public static final int ACTION_CLEAR_FOCUS
Action that clears input focus of the node.
See AccessibilityAction.ACTION_CLEAR_FOCUS
Constant Value:
2
(0x00000002)
ACTION_CLEAR_SELECTION
Added in API level 14
public static final int ACTION_CLEAR_SELECTION
Action that deselects the node.
Constant Value:
8
(0x00000008)
ACTION_CLICK
Added in API level 16
public static final int ACTION_CLICK
Action that clicks on the node info.
See also:
Constant Value:
16
(0x00000010)
ACTION_COLLAPSE
Added in API level 19
public static final int ACTION_COLLAPSE
Action to collapse an expandable node.
Constant Value:
524288
(0x00080000)
ACTION_COPY
Added in API level 18
public static final int ACTION_COPY
Action to copy the current selection to the clipboard.
Constant Value:
16384
(0x00004000)
ACTION_CUT
Added in API level 18
public static final 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
public static final int ACTION_DISMISS
Action to dismiss a dismissable node.
Constant Value:
1048576
(0x00100000)
ACTION_EXPAND
Added in API level 19
public static final int ACTION_EXPAND
Action to expand an expandable node.
Constant Value:
262144
(0x00040000)
ACTION_FOCUS
Added in API level 14
public static final int ACTION_FOCUS
Action that gives input focus to the node.
See AccessibilityAction.ACTION_FOCUS
Constant Value:
1
(0x00000001)
ACTION_LONG_CLICK
Added in API level 16
public static final int ACTION_LONG_CLICK
Action that long clicks on the node.
It does not support coordinate information for anchoring.
See also:
Constant Value:
32
(0x00000020)
ACTION_NEXT_AT_MOVEMENT_GRANULARITY
Added in API level 16
public static final 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)
public static final 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_STRINGBundle arguments = new Bundle(); arguments.putString(AccessibilityNodeInfo.ACTION_ARGUMENT_HTML_ELEMENT_STRING, "BUTTON"); info.performAction(AccessibilityNodeInfo.ACTION_NEXT_HTML_ELEMENT, arguments);
Constant Value: 1024 (0x00000400)
public static final int ACTION_PASTE
Action to paste the current clipboard content.
Constant Value: 32768 (0x00008000)
public static final 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_BOOLEANBundle 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)
public static final 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_STRINGBundle arguments = new Bundle(); arguments.putString(AccessibilityNodeInfo.ACTION_ARGUMENT_HTML_ELEMENT_STRING, "BUTTON"); info.performAction(AccessibilityNodeInfo.ACTION_PREVIOUS_HTML_ELEMENT, arguments);
Constant Value: 2048 (0x00000800)
public static final int ACTION_SCROLL_BACKWARD
Action to scroll the node content backward.
Constant Value: 8192 (0x00002000)
public static final int ACTION_SCROLL_FORWARD
Action to scroll the node content forward.
Constant Value: 4096 (0x00001000)
public static final int ACTION_SELECT
Action that selects the node.
See also:
Constant Value: 4 (0x00000004)
public static final int ACTION_SET_SELECTION
Action to set the selection. Performing this action with no arguments clears the selection.
See also:
Constant Value: 131072 (0x00020000)
public static final 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.
See also:
Constant Value: 2097152 (0x00200000)
public static final int CHECKED_STATE_FALSE
This node is not checked.
Constant Value: 0 (0x00000000)
public static final int CHECKED_STATE_PARTIAL
This node is partially checked. For example, when a checkbox owns a number of sub-options and they have different states, then the main checkbox is in a partially-checked state.
Constant Value: 2 (0x00000002)
public static final int CHECKED_STATE_TRUE
This node is checked.
Constant Value: 1 (0x00000001)
public static final int EXPANDED_STATE_COLLAPSED
Expanded state for a collapsed expandable element.
See also:
Constant Value: 1 (0x00000001)
public static final int EXPANDED_STATE_FULL
Expanded state for a expanded expandable element that cannot be expanded further.
See also:
Constant Value: 3 (0x00000003)
public static final int EXPANDED_STATE_PARTIAL
Expanded state for an expanded expandable element that can still be expanded further.
See also:
Constant Value: 2 (0x00000002)
public static final int EXPANDED_STATE_UNDEFINED
Expanded state for a non-expandable element
See also:
Constant Value: 0 (0x00000000)
public static final String EXTRA_DATA_RENDERING_INFO_KEY
Key used to request extra data for the rendering information.
The key requests that a AccessibilityNodeInfo.ExtraRenderingInfo be added to this
info. This request is made with refreshWithExtraData(String,Bundle) without
argument.
The data can be retrieved from the ExtraRenderingInfo returned by
getExtraRenderingInfo() using ExtraRenderingInfo.getLayoutSize,
ExtraRenderingInfo.getTextSizeInPx() and
ExtraRenderingInfo.getTextSizeUnit(). For layout params, it is supported by both
TextView and ViewGroup. For text size and unit, it is only supported by
TextView.
See also:
Constant Value: "android.view.accessibility.extra.DATA_RENDERING_INFO_KEY"
public static final String EXTRA_DATA_REQUEST_LAYOUT_BASED_ACTIONS_KEY
Key used to request that the node source re-evaluate and update this node's layout-dependent
actions. This request is made with refreshWithExtraData(String,Bundle) and takes no
arguments.
Some actions may depend on the on-screen layout of a node. In complex or dynamic UIs, it may be difficult for a source to determine if a node is truly actionable without more intensive inspection. For example, a node may be misreported as clickable despite being occluded, requiring a hit-test to confirm the availability of the action.
Using this key requests that the source perform a more intensive, layout-based analysis to
determine which actions are available to the user. After this request, the source will update
the actions and related properties of this node. For example, for clickability, this may
result in changes to the value returned by isClickable() and the presence of
AccessibilityAction.ACTION_CLICK in the node's getActionList().
This analysis can be computationally expensive and should only be requested when needed to resolve ambiguous or inaccurate actions.
Providers may advertise that they support this request using
setAvailableExtraData(List). Services may check for support with
getAvailableExtraData().
See also:
Constant Value: "android.view.accessibility.extra.DATA_REQUEST_LAYOUT_BASED_ACTIONS_KEY"
public static final String EXTRA_DATA_TEXT_CHARACTER_LOCATION_ARG_LENGTH
Integer argument specifying the end index of the requested text location data. Must be
positive and no larger than EXTRA_DATA_TEXT_CHARACTER_LOCATION_ARG_MAX_LENGTH.
See also:
Constant Value: "android.view.accessibility.extra.DATA_TEXT_CHARACTER_LOCATION_ARG_LENGTH"
public static final int EXTRA_DATA_TEXT_CHARACTER_LOCATION_ARG_MAX_LENGTH
The maximum allowed length of the requested text location data.
Constant Value: 20000 (0x00004e20)
public static final String EXTRA_DATA_TEXT_CHARACTER_LOCATION_ARG_START_INDEX
Integer argument specifying the start index of the requested text location data. Must be
valid inside the CharSequence returned by getText().
See also:
Constant Value: "android.view.accessibility.extra.DATA_TEXT_CHARACTER_LOCATION_ARG_START_INDEX"
public static final String EXTRA_DATA_TEXT_CHARACTER_LOCATION_IN_WINDOW_KEY
Key used to request and locate extra data for text character location in
window coordinates. This key requests that an array of
RectFs be added to the extras. This request is made
with refreshWithExtraData(String,Bundle). The arguments taken by
this request are two integers:
EXTRA_DATA_TEXT_CHARACTER_LOCATION_ARG_START_INDEX and
EXTRA_DATA_TEXT_CHARACTER_LOCATION_ARG_LENGTH. The starting index
must be valid inside the CharSequence returned by getText(), and
the length must be positive.
Providers may advertise that they support text characters in window coordinates using
setAvailableExtraData(List). Services may check if an implementation supports text
characters in window coordinates with getAvailableExtraData().
The data can be retrieved from the Bundle returned by
getExtras() using this string as a key for
Bundle.getParcelableArray(String,Class). The
RectF will be null for characters that either do
not exist or are outside of the window bounds.
Note that character locations in window bounds are not modified by changes in display magnification.
See also:
Constant Value: "android.view.accessibility.extra.DATA_TEXT_CHARACTER_LOCATION_IN_WINDOW_KEY"
public static final String EXTRA_DATA_TEXT_CHARACTER_LOCATION_KEY
Key used to request and locate extra data for text character location. This key requests that
an array of RectFs be added to the extras. This request is made with
refreshWithExtraData(String,Bundle). The arguments taken by this request are two
integers: EXTRA_DATA_TEXT_CHARACTER_LOCATION_ARG_START_INDEX and
EXTRA_DATA_TEXT_CHARACTER_LOCATION_ARG_LENGTH. The starting index must be valid
inside the CharSequence returned by getText(), and the length must be positive.
The data can be retrieved from the Bundle returned by getExtras() using this
string as a key for Bundle.getParcelableArray(String,Class). The
RectF will be null for characters that either do not exist
or are off the screen.
Note that character locations returned are modified by changes in display magnification.
See also:
Constant Value: "android.view.accessibility.extra.DATA_TEXT_CHARACTER_LOCATION_KEY"
public static final int FLAG_PREFETCH_ANCESTORS
Prefetching strategy that prefetches the ancestors of the requested node.
Ancestors will be prefetched before siblings and descendants.
See also:
Constant Value: 1 (0x00000001)
public static final int FLAG_PREFETCH_DESCENDANTS_BREADTH_FIRST
Prefetching strategy that prefetches the descendants of the requested node breadth-first.
This must not be combined with FLAG_PREFETCH_DESCENDANTS_HYBRID or
FLAG_PREFETCH_DESCENDANTS_DEPTH_FIRST or this will trigger an
IllegalArgumentException.
See FLAG_PREFETCH_ANCESTORS for information on where these flags can be used.
Constant Value: 16 (0x00000010)
public static final int FLAG_PREFETCH_DESCENDANTS_DEPTH_FIRST
Prefetching strategy that prefetches the descendants of the requested node depth-first.
This must not be combined with FLAG_PREFETCH_DESCENDANTS_HYBRID or
FLAG_PREFETCH_DESCENDANTS_BREADTH_FIRST or this will trigger an
IllegalArgumentException.
See FLAG_PREFETCH_ANCESTORS for information on where these flags can be used.
Constant Value: 8 (0x00000008)
public static final int FLAG_PREFETCH_DESCENDANTS_HYBRID
Prefetching strategy that prefetches the descendants in a hybrid depth first and breadth first approach.
The children of the root node is prefetched before recursing on the children. This
must not be combined with FLAG_PREFETCH_DESCENDANTS_DEPTH_FIRST or
FLAG_PREFETCH_DESCENDANTS_BREADTH_FIRST or this will trigger an
IllegalArgumentException.
See FLAG_PREFETCH_ANCESTORS for information on where these flags can be used.
Constant Value: 4 (0x00000004)
public static final int FLAG_PREFETCH_SIBLINGS
Prefetching strategy that prefetches the siblings of the requested node.
To avoid disconnected trees, this flag will also prefetch the parent. Siblings will be prefetched before descendants.
See FLAG_PREFETCH_ANCESTORS for information on where these flags can be used.
Constant Value: 2 (0x00000002)
public static final int FLAG_PREFETCH_UNINTERRUPTIBLE
Prefetching flag that specifies prefetching should not be interrupted by a request to retrieve a node or perform an action on a node.
See FLAG_PREFETCH_ANCESTORS for information on where these flags can be used.
Constant Value: 32 (0x00000020)
public static final int FOCUS_ACCESSIBILITY
The accessibility focus.
Constant Value: 2 (0x00000002)
public static final int FOCUS_INPUT
The input focus.
Constant Value: 1 (0x00000001)
public static final int MAX_NUMBER_OF_PREFETCHED_NODES
Maximum batch size of prefetched nodes for a request.
Constant Value: 50 (0x00000032)
public static final int MOVEMENT_GRANULARITY_CHARACTER
Movement granularity bit for traversing the text of a node by character.
Constant Value: 1 (0x00000001)
public static final int MOVEMENT_GRANULARITY_LINE
Movement granularity bit for traversing the text of a node by line.
Constant Value: 4 (0x00000004)
public static final int MOVEMENT_GRANULARITY_PAGE
Movement granularity bit for traversing the text of a node by page.
Constant Value: 16 (0x00000010)
public static final int MOVEMENT_GRANULARITY_PARAGRAPH
Movement granularity bit for traversing the text of a node by paragraph.
Constant Value: 8 (0x00000008)
public static final int MOVEMENT_GRANULARITY_WORD
Movement granularity bit for traversing the text of a node by word.
Constant Value: 2 (0x00000002)
public AccessibilityNodeInfo ()
Creates a new AccessibilityNodeInfo.
public AccessibilityNodeInfo (AccessibilityNodeInfo info)
Copy constructor. Creates a new AccessibilityNodeInfo, and this new instance is
initialized from the given info.
| Parameters | |
|---|---|
info |
AccessibilityNodeInfo: The other info.
This value cannot be null. |
public AccessibilityNodeInfo (View source)
Creates a new AccessibilityNodeInfo with the given source.
| Parameters | |
|---|---|
source |
View: The source view.
This value cannot be null. |
public AccessibilityNodeInfo (View root, int virtualDescendantId)
Creates a new AccessibilityNodeInfo with the given source.
| Parameters | |
|---|---|
root |
View: The root of the virtual subtree.
This value cannot be null. |
virtualDescendantId |
int: The id of the virtual descendant. |
public 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 | |
|---|---|
IllegalArgumentException |
If the argument is not one of the standard actions. |
IllegalStateException |
If called from an AccessibilityService. |
public 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 AccessibilityAction.
To add a custom action create a new 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.
Use androidx.core.view.ViewCompat.addAccessibilityAction(View,CharSequence,AccessibilityViewCommand) to register an action directly on the view.
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. |
public void addChild (View root, int virtualDescendantId)
Adds a virtual child which is a descendant of the given root.
If virtualDescendantId is View.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. Note that a view cannot be made its own child.
| Parameters | |
|---|---|
root |
View: The root of the virtual subtree. |
virtualDescendantId |
int: The id of the virtual child. |
public 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.
Note that a view cannot be made its own child.
| Parameters | |
|---|---|
child |
View: The child. |
| Throws | |
|---|---|
IllegalStateException |
If called from an AccessibilityService. |
public void addLabeledBy (View label)
Adds the view which serves as the label of the view represented by this info for accessibility purposes. When multiple labels are added, the content from each label is combined in the order that they are added.
If visible text can be used to describe or give meaning to this UI, this method is preferred. For example, a TextView before an EditText in the UI usually specifies what information is contained in the EditText. Hence, the EditText is labeled by the TextView.
| Parameters | |
|---|---|
label |
View: A view that labels this node's source.
This value cannot be null. |
public void addLabeledBy (View root, int virtualDescendantId)
Adds the view which serves as the label of the view represented by
this info for accessibility purposes. If virtualDescendantId
is View.NO_ID the root is set as the label. When multiple
labels are added, the content from each label is combined in the order
that they are added.
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.
If visible text can be used to describe or give meaning to this UI, this method is preferred. For example, a TextView before an EditText in the UI usually specifies what information is contained in the EditText. Hence, the EditText is labeled by the TextView.
Note: Cannot be called from an
AccessibilityService.
This class is made immutable before being delivered to an AccessibilityService.
| Parameters | |
|---|---|
root |
View: A root whose virtual descendant labels this node's source.
This value cannot be null. |
virtualDescendantId |
int: The id of the virtual descendant. |
public boolean canOpenPopup ()
Gets if this node opens a popup or a dialog.
| Returns | |
|---|---|
boolean |
If the the node opens a popup. |
public int describeContents ()
Describe the kinds of special objects contained in this Parcelable
instance's marshaled representation. For example, if the object will
include a file descriptor in the output of writeToParcel(Parcel,int),
the return value of this method must include the
CONTENTS_FILE_DESCRIPTOR bit.
int0 or
public boolean equals (Object object)
Indicates whether some other object is "equal to" this one.
The equals method implements an equivalence relation
on non-null object references:
x, x.equals(x) should return
true.
x and y, x.equals(y)
should return true if and only if
y.equals(x) returns true.
x, y, and z, if
x.equals(y) returns true and
y.equals(z) returns true, then
x.equals(z) should return true.
x and y, multiple invocations of
x.equals(y) consistently return true
or consistently return false, provided no
information used in equals comparisons on the
objects is modified.
x,
x.equals(null) should return false.
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.
| Parameters | |
|---|---|
object |
Object: This value may be null. |
| Returns | |
|---|---|
boolean |
true if this object is the same as the obj
argument; false otherwise. |
public 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: If this view hierarchy has a SurfaceView embedding another
view hierarchy via SurfaceView.setChildSurfacePackage, there is a limitation that
this API won't be able to find the node for the view on the embedded view hierarchy. It's
because views don't know about the embedded hierarchies. Instead, you could traverse all
the children to find the node.
| Parameters | |
|---|---|
text |
String: The searched text. |
| Returns | |
|---|---|
List<AccessibilityNodeInfo> |
A list of node info. |
public 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: 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 AccessibilityServiceInfo.FLAG_REPORT_VIEW_IDS
flag when configuring the AccessibilityService.
Note: If this view hierarchy has a SurfaceView embedding another
view hierarchy via SurfaceView.setChildSurfacePackage, there is a limitation that
this API won't be able to find the node for the view on the embedded view hierarchy. It's
because views don't know about the embedded hierarchies. Instead, you could traverse all
the children to find the node.
| Parameters | |
|---|---|
viewId |
String: The fully qualified resource name of the view id to find.
This value cannot be null. |
| Returns | |
|---|---|
List<AccessibilityNodeInfo> |
A list of node info. |
public AccessibilityNodeInfo findFocus (int focus)
Find the view that has the specified focus type. The search starts from the view represented by this node info.
Note: If this view hierarchy has a SurfaceView embedding another
view hierarchy via SurfaceView.setChildSurfacePackage, there is a limitation that
this API won't be able to find the node for the view on the embedded view hierarchy. It's
because views don't know about the embedded hierarchies. Instead, you could traverse all
the children to find the node. Or, use AccessibilityService.findFocus(int) for
FOCUS_ACCESSIBILITY only since it has no such limitation.
| 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:
public AccessibilityNodeInfo focusSearch (int direction)
Searches for the nearest view in the specified direction that can take the input focus.
Note: If this view hierarchy has a SurfaceView embedding another
view hierarchy via SurfaceView.setChildSurfacePackage, there is a limitation that
this API won't be able to find the node for the view in the specified direction on the
embedded view hierarchy. It's because views don't know about the embedded hierarchies.
Instead, you could traverse all the children to find the node.
| Parameters | |
|---|---|
direction |
int: The direction. Can be one of:
View.FOCUS_DOWN,
View.FOCUS_UP,
View.FOCUS_LEFT,
View.FOCUS_RIGHT,
View.FOCUS_FORWARD,
View.FOCUS_BACKWARD. |
| Returns | |
|---|---|
AccessibilityNodeInfo |
The node info for the view that can take accessibility focus. |
public List<AccessibilityNodeInfo.AccessibilityAction> getActionList ()
Gets the actions that can be performed on the node.
| Returns | |
|---|---|
List<AccessibilityNodeInfo.AccessibilityAction> |
|
public int getActions ()
This method was deprecated
in API level 21.
Use getActionList().
Gets the actions that can be performed on the node.
| Returns | |
|---|---|
int |
The bit mask of with actions. |
See also:
AccessibilityNodeInfo.ACTION_FOCUSAccessibilityNodeInfo.ACTION_CLEAR_FOCUSAccessibilityNodeInfo.ACTION_SELECTAccessibilityNodeInfo.ACTION_CLEAR_SELECTIONAccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUSAccessibilityNodeInfo.ACTION_CLEAR_ACCESSIBILITY_FOCUSAccessibilityNodeInfo.ACTION_CLICKAccessibilityNodeInfo.ACTION_LONG_CLICKAccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITYAccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITYAccessibilityNodeInfo.ACTION_NEXT_HTML_ELEMENTAccessibilityNodeInfo.ACTION_PREVIOUS_HTML_ELEMENTAccessibilityNodeInfo.ACTION_SCROLL_FORWARDAccessibilityNodeInfo.ACTION_SCROLL_BACKWARDpublic List<String> getAvailableExtraData ()
Get the extra data available for this node.
Some data that is useful for some accessibility services is expensive to compute, and would
place undue overhead on apps to compute all the time. That data can be requested with
refreshWithExtraData(String,Bundle).
| Returns | |
|---|---|
List<String> |
An unmodifiable list of keys corresponding to extra data that can be requested. |
public void getBoundsInParent (Rect outBounds)
This method was deprecated
in API level 29.
Use getBoundsInScreen(Rect) instead.
Gets the node bounds in the viewParent's coordinates.
getParent() does not represent the source's viewParent.
Instead it represents the result of View.getParentForAccessibility(),
which returns the closest ancestor where View.isImportantForAccessibility() is true.
So this method is not reliable.
When magnification is enabled, the bounds in parent are also scaled up by magnification scale. For example, it returns Rect(20, 20, 200, 200) for original bounds Rect(10, 10, 100, 100), when the magnification scale is 2.
| Parameters | |
|---|---|
outBounds |
Rect: The output node bounds. |
public void getBoundsInScreen (Rect outBounds)
Gets the node bounds in screen coordinates.
When magnification is enabled, the bounds in screen are scaled up by magnification scale and the positions are also adjusted according to the offset of magnification viewport. For example, it returns Rect(-180, -180, 0, 0) for original bounds Rect(10, 10, 100, 100), when the magnification scale is 2 and offsets for X and Y are both 200.
| Parameters | |
|---|---|
outBounds |
Rect: The output node bounds. |
public void getBoundsInWindow (Rect outBounds)
Gets the node bounds in window coordinates.
The node bounds returned are not scaled by magnification.
| Parameters | |
|---|---|
outBounds |
Rect: The output node bounds.
This value cannot be null. |
public int getChecked ()
Gets the checked state of this node. This is only meaningful
when isCheckable() returns true.
intpublic AccessibilityNodeInfo getChild (int index)
Get the child at given index.
| Parameters | |
|---|---|
index |
int: The child index. |
| Returns | |
|---|---|
AccessibilityNodeInfo |
The child node. |
| Throws | |
|---|---|
IllegalStateException |
If called outside of an AccessibilityService and before
calling setQueryFromAppProcessEnabled(View, boolean). |
public AccessibilityNodeInfo getChild (int index,
int prefetchingStrategy)Get the child at given index.
See getParent(int) for a description of prefetching.
indexint: The child index.prefetchingStrategyint: the prefetching strategy.
0 or a combination of the following:
FLAG_PREFETCH_ANCESTORSFLAG_PREFETCH_SIBLINGSFLAG_PREFETCH_DESCENDANTS_HYBRIDFLAG_PREFETCH_DESCENDANTS_DEPTH_FIRSTFLAG_PREFETCH_DESCENDANTS_BREADTH_FIRSTFLAG_PREFETCH_UNINTERRUPTIBLE| Returns | |
|---|---|
AccessibilityNodeInfo |
The child node.
This value may be null. |
| Throws | |
|---|---|
IllegalStateException |
If called outside of an AccessibilityService and before
calling setQueryFromAppProcessEnabled(View, boolean). |
public int getChildCount ()
Gets the number of children.
| Returns | |
|---|---|
int |
The child count. |
public CharSequence getClassName ()
Gets the class this node comes from.
| Returns | |
|---|---|
CharSequence |
The class name. |
public 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. |
public 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. |
public CharSequence getContainerTitle ()
Returns the container title.
| Returns | |
|---|---|
CharSequence |
This value may be null. |
See also:
public CharSequence getContentDescription ()
Gets the content description of this node.
| Returns | |
|---|---|
CharSequence |
The content description. |
public 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. |
public CharSequence getError ()
Gets the error text of this node.
| Returns | |
|---|---|
CharSequence |
The error text. |
public int getExpandedState ()
Gets the expanded state for this node.
intpublic AccessibilityNodeInfo.ExtraRenderingInfo getExtraRenderingInfo ()
Gets the extra rendering info if the node is meant to be
refreshed with extra data to examine rendering related accessibility issues.
| Returns | |
|---|---|
AccessibilityNodeInfo.ExtraRenderingInfo |
The extra rendering info.
This value may be null. |
public 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. |
public CharSequence getHintText ()
Gets the hint text of this node. Only applies to nodes where text can be entered.
| Returns | |
|---|---|
CharSequence |
The hint text. |
public int getInputType ()
Gets the input type of the source as defined by InputType.
| Returns | |
|---|---|
int |
The input type. |
public AccessibilityNodeInfo getLabelFor ()
This method was deprecated
in API level 36.
Use getLabeledByList() on the labeled node instead,
since calling addLabeledBy(View) or addLabeledBy(View,int)
on the labeled node do not automatically provide that node from this method.
Gets the node info for which the view represented by this info serves as a label for accessibility purposes.
| Returns | |
|---|---|
AccessibilityNodeInfo |
The labeled info. |
public AccessibilityNodeInfo getLabeledBy ()
This method was deprecated
in API level 36.
Use getLabeledByList() instead.
Gets the node info which serves as the label of the view represented by this info for accessibility purposes.
| Returns | |
|---|---|
AccessibilityNodeInfo |
The label. |
public List<AccessibilityNodeInfo> getLabeledByList ()
Gets the list of node infos which serve as the labels of the view represented by this info for accessibility purposes.
| Returns | |
|---|---|
List<AccessibilityNodeInfo> |
The list of labels in the order that they were added.
This value cannot be null. |
public 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,
a Snackbar that displays a confirmation notification should be marked
as a live region with mode
View.ACCESSIBILITY_LIVE_REGION_POLITE.
It is the responsibility of the accessibility service to monitor
AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED events indicating
changes to live region nodes and their children.
| Returns | |
|---|---|
int |
The live region mode, or
View.ACCESSIBILITY_LIVE_REGION_NONE if the view is not a
live region. |
See also:
public int getMaxTextLength ()
Returns the maximum text length for this node.
| Returns | |
|---|---|
int |
The maximum text length, or -1 for no limit. |
See also:
public Duration getMinDurationBetweenContentChanges ()
Gets the minimum time duration between two content change events.
| Returns | |
|---|---|
Duration |
This value cannot be null. |
public int getMovementGranularities ()
Gets the movement granularities for traversing the text of this node.
| Returns | |
|---|---|
int |
The bit mask with granularities. |
public CharSequence getPackageName ()
Gets the package this node comes from.
| Returns | |
|---|---|
CharSequence |
The package name. |
public 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. |
public AccessibilityNodeInfo getParent ()
Gets the parent.
| Returns | |
|---|---|
AccessibilityNodeInfo |
The parent. |
| Throws | |
|---|---|
IllegalStateException |
If called outside of an AccessibilityService and before
calling setQueryFromAppProcessEnabled(View, boolean). |
public AccessibilityNodeInfo getParent (int prefetchingStrategy)
Gets the parent.
Use prefetchingStrategy to determine the types of
nodes prefetched from the app if the requested node is not in the cache and must be retrieved
by the app. The default strategy for getParent() is a combination of ancestor and
sibling strategies. The app will prefetch until all nodes fulfilling the strategies are
fetched, another node request is sent, or the maximum prefetch batch size of
MAX_NUMBER_OF_PREFETCHED_NODES nodes is reached. To prevent interruption by another
request and to force prefetching of the max batch size, use
AccessibilityNodeInfo.FLAG_PREFETCH_UNINTERRUPTIBLE.
prefetchingStrategyint: the prefetching strategy.
0 or a combination of the following:
FLAG_PREFETCH_ANCESTORSFLAG_PREFETCH_SIBLINGSFLAG_PREFETCH_DESCENDANTS_HYBRIDFLAG_PREFETCH_DESCENDANTS_DEPTH_FIRSTFLAG_PREFETCH_DESCENDANTS_BREADTH_FIRSTFLAG_PREFETCH_UNINTERRUPTIBLE| Returns | |
|---|---|
AccessibilityNodeInfo |
The parent.
This value may be null. |
| Throws | |
|---|---|
IllegalStateException |
If called outside of an AccessibilityService and before
calling setQueryFromAppProcessEnabled(View, boolean). |
See also:
public AccessibilityNodeInfo.RangeInfo getRangeInfo ()
Gets the range info if this node is a range.
| Returns | |
|---|---|
AccessibilityNodeInfo.RangeInfo |
The range. |
public AccessibilityNodeInfo.Selection getSelection ()
Gets the extended selection, which is a representation of selection that spans multiple nodes that exist within the subtree of the node defining selection.
Note: Nodes that are candidates to contain a selection should return
true from isFocusable() and isFocused().
The start and end SelectionPositions of this Selection
should exist within this node or its descendants.
| Returns | |
|---|---|
AccessibilityNodeInfo.Selection |
The extended selection within the node's subtree, or null if no selection
exists. |
public CharSequence getStateDescription ()
Get the state description of this node.
| Returns | |
|---|---|
CharSequence |
the state description.
This value may be null. |
public AccessibilityNodeInfo.StructuredDataInfo getStructuredDataInfo ()
Gets additional structured data properties of this node. This is only populated for nodes that offer additional structured data, like a mathematical expression.
| Returns | |
|---|---|
AccessibilityNodeInfo.StructuredDataInfo |
A concrete subclass of StructuredDataInfo representing the type and
additional structured data for this node, or null if this node does not have
additional structured data attached. |
public CharSequence getSupplementalDescription ()
Gets the supplemental description of this node. A supplemental description provides
brief supplemental information for this node, such as the purpose of the node when
that purpose is not conveyed within its textual representation. For example, if a
dropdown select has a purpose of setting font family, the supplemental description
could be "font family". If this node has children, its supplemental description serves
as additional information and is not intended to replace any existing information
in the subtree. This is different from the getContentDescription() in that
this description is purely supplemental while a content description may be used
to replace a description for a node or its subtree that an assistive technology
would otherwise compute based on other properties of the node and its descendants.
| Returns | |
|---|---|
CharSequence |
The supplemental description.
This value may be null. |
public CharSequence getText ()
Gets the text of this node.
Note: If the text contains ClickableSpans or URLSpans,
these spans will have been replaced with ones whose ClickableSpan.onClick(View)
can be called from an AccessibilityService. When called from a service, the
View argument is ignored and the corresponding span will be found on the view that
this AccessibilityNodeInfo represents and called with that view as its argument.
This treatment of ClickableSpans means that the text returned from this method may
different slightly one passed to setText(CharSequence), although they will be
equivalent according to TextUtils.equals(CharSequence,CharSequence). The
ClickableSpan.onClick(View) of any spans, however, will generally not work outside
of an accessibility service.
| Returns | |
|---|---|
CharSequence |
The text. |
public int getTextSelectionEnd ()
Gets the text selection end if text is selected.
If no text is selected, both this method and
AccessibilityNodeInfo.getTextSelectionStart() return the same value:
the current location of the cursor.
| Returns | |
|---|---|
int |
The text selection end, the cursor location if there is no selection, or -1 if there is no text selection and no cursor. |
public int getTextSelectionStart ()
Gets the text selection start or the cursor position.
If no text is selected, both this method and
AccessibilityNodeInfo.getTextSelectionEnd() return the same value:
the current location of the cursor.
| Returns | |
|---|---|
int |
The text selection start, the cursor location if there is no selection, or -1 if there is no text selection and no cursor. |
public CharSequence getTooltipText ()
Gets the tooltip text of this node.
| Returns | |
|---|---|
CharSequence |
The tooltip text.
This value may be null. |
public AccessibilityNodeInfo.TouchDelegateInfo getTouchDelegateInfo ()
Get the TouchDelegateInfo for touch delegate behavior with the represented view.
It is possible for the same node to be pointed to by several regions. Use
TouchDelegateInfo.getRegionAt(int) to get touch delegate target Region, and
TouchDelegateInfo.getTargetForRegion(Region) for AccessibilityNodeInfo from
the given region.
| Returns | |
|---|---|
AccessibilityNodeInfo.TouchDelegateInfo |
TouchDelegateInfo or null if there are no touch delegates. |
public 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. |
public 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. |
public String getUniqueId ()
Gets the unique id of the node.
| Returns | |
|---|---|
String |
The unique id.
This value may be null. |
public 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 AccessibilityServiceInfo.FLAG_REPORT_VIEW_IDS
flag when configuring the AccessibilityService.
| Returns | |
|---|---|
String |
The id resource name. |
public AccessibilityWindowInfo getWindow ()
Gets the window to which this node belongs.
| Returns | |
|---|---|
AccessibilityWindowInfo |
The window. |
See also:
public int getWindowId ()
Returns the id of the window that created this node.
Note: If this node comes from a window that is embedded in another window
using SurfaceView then the return value is the id of the window that embeds this
node's window.
| Returns | |
|---|---|
int |
The window id. |
public boolean hasRequestInitialAccessibilityFocus ()
Gets whether the node has setRequestInitialAccessibilityFocus(boolean).
| Returns | |
|---|---|
boolean |
True if the node has requested initial accessibility focus. |
public int hashCode ()
Returns a hash code value for the object. This method is
supported for the benefit of hash tables such as those provided by
HashMap.
The general contract of hashCode is:
hashCode method
must consistently return the same integer, provided no information
used in equals comparisons on the object is modified.
This integer need not remain consistent from one execution of an
application to another execution of the same application.
equals method, then calling the hashCode method on each of the two objects must produce the
same integer result.
equals method, then
calling the hashCode method on each of the two objects
must produce distinct integer results. However, the programmer
should be aware that producing distinct integer results for
unequal objects may improve the performance of hash tables.
| Returns | |
|---|---|
int |
a hash code value for this object. |
public boolean isAccessibilityDataSensitive ()
Gets if the node's accessibility data is considered sensitive.
| Returns | |
|---|---|
boolean |
True if the node's data is considered sensitive, false otherwise. |
See also:
public boolean isAccessibilityFocused ()
Gets whether this node is accessibility focused.
This is distinct from isFocused(), which is used to track system focus.
See ACTION_ACCESSIBILITY_FOCUS for details.
| Returns | |
|---|---|
boolean |
True if the node is accessibility focused. |
public boolean isCheckable ()
Gets whether this node is checkable.
| Returns | |
|---|---|
boolean |
True if the node is checkable. |
public boolean isChecked ()
This method was deprecated
in API level 36.
Use getChecked() instead.
Gets whether this node is checked. This is only meaningful
when isCheckable() returns true.
| Returns | |
|---|---|
boolean |
True if the node is checked. |
public boolean isClickable ()
Gets whether this node is clickable.
| Returns | |
|---|---|
boolean |
True if the node is clickable. |
public 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. |
public boolean isContextClickable ()
Gets whether this node is context clickable.
| Returns | |
|---|---|
boolean |
True if the node is context clickable. |
public boolean isDismissable ()
Gets if the node can be dismissed.
| Returns | |
|---|---|
boolean |
If the node can be dismissed. |
public boolean isEditable ()
Gets if the node is editable.
| Returns | |
|---|---|
boolean |
True if the node is editable, false otherwise. |
public boolean isEnabled ()
Gets whether this node is enabled.
| Returns | |
|---|---|
boolean |
True if the node is enabled. |
public boolean isFieldRequired ()
Gets whether a node representing a form field requires input or selection.
| Returns | |
|---|---|
boolean |
true if this node represents a form field that requires input or
selection, false otherwise. |
public boolean isFocusable ()
Gets whether this node is focusable.
In the View system, this typically maps to View.isFocusable().
| Returns | |
|---|---|
boolean |
True if the node is focusable. |
public boolean isFocused ()
Gets whether this node is focused.
This is distinct from isAccessibilityFocused(), which is used by screen readers.
See AccessibilityAction.ACTION_ACCESSIBILITY_FOCUS for details.
| Returns | |
|---|---|
boolean |
True if the node is focused. |
public boolean isGranularScrollingSupported ()
Gets if the node supports granular scrolling.
| Returns | |
|---|---|
boolean |
True if all scroll actions that could support
ACTION_ARGUMENT_SCROLL_AMOUNT_FLOAT have done so, false otherwise. |
public boolean isHeading ()
Returns whether node represents a heading.
Note: Returns true if either setHeading(boolean)
marks this node as a heading or if the node has a CollectionItemInfo that marks
it as such, to accomodate apps that use the now-deprecated API.
| Returns | |
|---|---|
boolean |
true if the node is a heading, false otherwise. |
public 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 |
See also:
public boolean isLongClickable ()
Gets whether this node is long clickable.
| Returns | |
|---|---|
boolean |
True if the node is long clickable. |
public boolean isMultiLine ()
Gets if the node is a multi line editable text.
| Returns | |
|---|---|
boolean |
True if the node is multi line. |
public boolean isPassword ()
Gets whether this node is a password.
| Returns | |
|---|---|
boolean |
True if the node is a password. |
public 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. |
See also:
public boolean isScrollable ()
Gets if the node is scrollable.
| Returns | |
|---|---|
boolean |
True if the node is scrollable, false otherwise. |
public boolean isSelected ()
Gets whether this node is selected.
| Returns | |
|---|---|
boolean |
True if the node is selected. |
public 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. |
public boolean isTextEntryKey ()
Returns whether node represents a text entry key that is part of a keyboard or keypad.
| Returns | |
|---|---|
boolean |
true if the node is a text entry key., false otherwise. |
public boolean isTextSelectable ()
Gets if the node has selectable text.
Services should use ACTION_SET_SELECTION for selection. Editable text nodes must
also be selectable. But not all UIs will populate this field, so services should consider
'isTextSelectable | isEditable' to ensure they don't miss nodes with selectable text.
| Returns | |
|---|---|
boolean |
True if the node has selectable text. |
See also:
public boolean isVisibleToUser ()
Gets whether this node is visible to the user.
Between API 16 and
API 29, this method may incorrectly return false when
magnification is enabled. On other versions, a node is considered visible even if it is not
on the screen because magnification is active.
| Returns | |
|---|---|
boolean |
Whether the node is visible to the user. |
public static AccessibilityNodeInfo obtain (View root, int virtualDescendantId)
This method was deprecated
in API level 33.
Object pooling has been discontinued. Create a new instance using the
constructor AccessibilityNodeInfo(View,int) instead.
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:
public static AccessibilityNodeInfo obtain (AccessibilityNodeInfo info)
This method was deprecated
in API level 33.
Object pooling has been discontinued. Create a new instance using the
constructor AccessibilityNodeInfo(AccessibilityNodeInfo) instead.
Instantiates a new AccessibilityNodeInfo initialized from the given
info.
| Parameters | |
|---|---|
info |
AccessibilityNodeInfo: The other info. |
| Returns | |
|---|---|
AccessibilityNodeInfo |
An instance. |
public static AccessibilityNodeInfo obtain ()
This method was deprecated
in API level 33.
Object pooling has been discontinued. Create a new instance using the
constructor AccessibilityNodeInfo() instead.
Instantiates a new AccessibilityNodeInfo.
| Returns | |
|---|---|
AccessibilityNodeInfo |
An instance. |
public static AccessibilityNodeInfo obtain (View source)
This method was deprecated
in API level 33.
Object pooling has been discontinued. Create a new instance using the
constructor AccessibilityNodeInfo(View) instead.
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:
public 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. |
public 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. |
public void recycle ()
This method was deprecated
in API level 33.
Object pooling has been discontinued. Calling this function now will have
no effect.
Would previously return an instance back to be reused.
public boolean refresh ()
Refreshes this info with the latest state of the view it represents.
| Returns | |
|---|---|
boolean |
true if the refresh succeeded. false if the View represented
by this node is no longer in the view tree (and thus this node is obsolete). |
public boolean refreshWithExtraData (String extraDataKey, Bundle args)
Refreshes this info with the latest state of the view it represents, and request new data be added by the View.
| Parameters | |
|---|---|
extraDataKey |
String: The extra data requested. Data that must be requested
with this mechanism is generally expensive to retrieve, so should only be
requested when needed. See
EXTRA_DATA_RENDERING_INFO_KEY,
EXTRA_DATA_TEXT_CHARACTER_LOCATION_KEY,
getAvailableExtraData() and getExtraRenderingInfo(). |
args |
Bundle: A bundle of arguments for the request. These depend on the particular request. |
| Returns | |
|---|---|
boolean |
true if the refresh succeeded. false if the View represented
by this node is no longer in the view tree (and thus this node is obsolete). |
public 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. |
public 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. |
public 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:
public 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. |
public boolean removeLabeledBy (View root, int virtualDescendantId)
Removes a label which is a virtual descendant of the given
root. If virtualDescendantId is
View.NO_ID the root is set as the label. If the label
was not previously added to the node, calling this method has
no effect.
| Parameters | |
|---|---|
root |
View: The root of the virtual subtree.
This value cannot be null. |
virtualDescendantId |
int: The id of the virtual node which serves as this node's label. |
| Returns | |
|---|---|
boolean |
true if the label was present |
See also:
public boolean removeLabeledBy (View label)
Removes a label. If the label 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 | |
|---|---|
label |
View: The node which serves as this node's label.
This value cannot be null. |
| Returns | |
|---|---|
boolean |
true if the label was present |
See also:
public void setAccessibilityDataSensitive (boolean accessibilityDataSensitive)
Sets whether this node's accessibility data is considered sensitive.
Note: Cannot be called from an AccessibilityService.
This class is made immutable before being delivered to an AccessibilityService.
| Parameters | |
|---|---|
accessibilityDataSensitive |
boolean: True if the node's accessibility data is considered
sensitive. |
| Throws | |
|---|---|
IllegalStateException |
If called from an AccessibilityService. |
See also:
public 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.
The UI element updating this property should send an event of
AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUSED
or AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED if its
accessibility-focused state changes.
| Parameters | |
|---|---|
focused |
boolean: True if the node is accessibility focused. |
| Throws | |
|---|---|
IllegalStateException |
If called from an AccessibilityService. |
public void setAvailableExtraData (List<String> extraDataKeys)
Set the extra data available for this node.
Note: When a View passes in a non-empty list, it promises that
it will populate the node's extras with corresponding pieces of information in
View.addExtraDataToAccessibilityNodeInfo(AccessibilityNodeInfo,String,Bundle).
Note: Cannot be called from an
AccessibilityService.
This class is made immutable before being delivered to an AccessibilityService.
| Parameters | |
|---|---|
extraDataKeys |
List: A list of types of extra data that are available. |
| Throws | |
|---|---|
IllegalStateException |
If called from an AccessibilityService. |
See also:
public void setBoundsInParent (Rect bounds)
This method was deprecated
in API level 29.
Accessibility services should not care about these bounds.
Sets the node bounds in the viewParent's coordinates.
getParent() does not represent the source's viewParent.
Instead it represents the result of View.getParentForAccessibility(),
which returns the closest ancestor where View.isImportantForAccessibility() is true.
So this method is not reliable.
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. |
public 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. |
public void setBoundsInWindow (Rect bounds)
Sets the node bounds in window 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.
This value cannot be null. |
| Throws | |
|---|---|
IllegalStateException |
If called from an AccessibilityService. |
public 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. |
public 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. |
public void setChecked (boolean checked)
This method was deprecated
in API level 36.
Use setChecked(int) instead.
Sets whether this node is checked. This is only meaningful
when isCheckable() returns true.
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. |
public void setChecked (int checked)
Sets the checked state of this node. This is only meaningful
when isCheckable() returns true.
Note: Cannot be called from an
AccessibilityService.
This class is made immutable before being delivered to an AccessibilityService.
checkedint: The checked state. One of
.
| Throws | |
|---|---|
IllegalArgumentException |
if checked is not one of CHECKED_STATE_FALSE,
CHECKED_STATE_TRUE, or CHECKED_STATE_PARTIAL. |
IllegalStateException |
If called from an AccessibilityService. |
public 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. |
public 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. |
public 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. |
public 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 |
public void setContainerTitle (CharSequence containerTitle)
Sets the container title for app-developer-defined container which can be any type of ViewGroup or layout. Container title will be used to group together related controls, similar to HTML fieldset. Or container title may identify a large piece of the UI that is visibly grouped together, such as a toolbar or a card, etc.
Container title helps to assist in navigation across containers and other groups. For example, a screen reader may use this to determine where to put accessibility focus.
Container title is different from pane titlesetPaneTitle(CharSequence) which indicates that the
node represents a window or activity.
Example: An app can set container titles on several non-modal menus, containing TextViews or ImageButtons that have content descriptions, text, etc. Screen readers can quickly switch accessibility focus among menus instead of child views. Other accessibility-services can easily find the menu.
| Parameters | |
|---|---|
containerTitle |
CharSequence: The container title that is associated with a ViewGroup/Layout on the
screen.
This value may be null. |
public 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. |
public 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. |
public 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. |
public 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. |
public 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. |
public 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. |
public 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. |
public 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. |
public void setExpandedState (int state)
Sets the expanded state of the node.
Note: Cannot be called from an AccessibilityService. This class is made immutable before being
delivered to an AccessibilityService.
stateint: new expanded state of this node.
| Throws | |
|---|---|
IllegalArgumentException |
If state is not one of: |
IllegalStateException |
If called from an AccessibilityService |
public void setExtraRenderingInfo (AccessibilityNodeInfo.ExtraRenderingInfo extraRenderingInfo)
, if the node is meant to be
refreshed with extra data.
Note: Cannot be called from an
AccessibilityService.
This class is made immutable before being delivered to an AccessibilityService.
Parameters
extraRenderingInfo
AccessibilityNodeInfo.ExtraRenderingInfo: The extra rendering info, or
null to remove a previously set value.
setFieldRequired
Added in API level 36
public void setFieldRequired (boolean required)
Sets whether this node represents a form field that requires input or selection.
Note: Cannot be called from an AccessibilityService. This class is made
immutable before being delivered to an AccessibilityService.
Parameters
required
boolean: true if input or selection of this node should be required, false otherwise.
Throws
IllegalStateException
If called from an AccessibilityService
setFocusable
Added in API level 14
public 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.
To mark a node as explicitly focusable for a screen reader, consider using
setScreenReaderFocusable(boolean) instead.
Parameters
focusable
boolean: True if the node is focusable.
Throws
IllegalStateException
If called from an AccessibilityService.
setFocused
Added in API level 14
public 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.
setGranularScrollingSupported
Added in API level 35
public void setGranularScrollingSupported (boolean granularScrollingSupported)
Sets if the node supports granular scrolling. This should be set to true if all scroll
actions which could support ACTION_ARGUMENT_SCROLL_AMOUNT_FLOAT have done so.
Note: Cannot be called from an
AccessibilityService.
This class is made immutable before being delivered to an AccessibilityService.
Parameters
granularScrollingSupported
boolean: True if the node supports granular scrolling, false
otherwise.
Throws
IllegalStateException
If called from an AccessibilityService.
setHeading
Added in API level 28
public void setHeading (boolean isHeading)
Sets whether the node represents a heading.
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
Added in API level 26
public void setHintText (CharSequence hintText)
Sets the hint text of this node. Only applies to nodes where text can be entered.
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 API level 24
public 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 API level 19
public 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
public void setLabelFor (View root,
int virtualDescendantId)
This method was deprecated
in API level 36.
Use addLabeledBy(View) on the labeled node instead,
since getLabeledByList() and getLabeledBy() on the
labeled node are not automatically populated when this method is used.
Sets the view for which the view represented by this info serves as a
label for accessibility purposes. If virtualDescendantId
is View.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.
setLabelFor
public void setLabelFor (View labeled)
This method was deprecated
in API level 36.
Use addLabeledBy(View) on the labeled node instead,
since getLabeledByList() and getLabeledBy() on the
labeled node are not automatically populated when this method is used.
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
public void setLabeledBy (View label)
This method was deprecated
in API level 36.
Use addLabeledBy(View) or removeLabeledBy(View) instead.
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
public void setLabeledBy (View root,
int virtualDescendantId)
This method was deprecated
in API level 36.
Use addLabeledBy(View,int) or removeLabeledBy(View,int)
instead.
Sets the view which serves as the label of the view represented by
this info for accessibility purposes. If virtualDescendantId
is View.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
public 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
View.ACCESSIBILITY_LIVE_REGION_NONE if the view is not a
live region.
See also:
setLongClickable
Added in API level 14
public 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
public 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:
setMinDurationBetweenContentChanges
Added in API level 34
public void setMinDurationBetweenContentChanges (Duration duration)
Sets the minimum time duration between two content change events, which is used in throttling
content change events in accessibility services.
Example: An app can set MinMillisBetweenContentChanges as 1 min for a view which sends
content change events to accessibility services one event per second.
Accessibility service will throttle those content change events and only handle one event
per minute for that view.
Example UI elements that frequently update and may benefit from a duration are progress bars,
timers, and stopwatches.
Parameters
duration
Duration: the minimum duration between content change events.
Negative duration would be treated as zero.
This value cannot be null.
setMovementGranularities
Added in API level 16
public 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
public 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
public 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
Added in API level 28
public 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.
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 pane represented by this node.
This value may be null.
setParent
Added in API level 16
public void setParent (View root,
int virtualDescendantId)
Sets the parent to be a virtual descendant of the given root.
If virtualDescendantId equals to View.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 API level 14
public 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 API level 14
public 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.
setQueryFromAppProcessEnabled
Added in API level 34
public void setQueryFromAppProcessEnabled (View view,
boolean enabled)
Connects this node to the View's root so that operations on this node can query the entire
AccessibilityNodeInfo tree and perform accessibility actions on nodes.
Testing or debugging tools should create this AccessibilityNodeInfo node using
View.createAccessibilityNodeInfo() or AccessibilityNodeProvider and call this
method, then navigate and interact with the node tree by calling methods on the node.
Calling this method more than once on the same node is a no-op. After calling this method,
all nodes linked to this node (children, ancestors, etc.) are also queryable.
Here "query" refers to the following node operations:
check properties of this node (example: isScrollable())
find and query children (example: getChild(int))
find and query the parent (example: getParent())
find focus (examples: findFocus(int), focusSearch(int))
find and query other nodes (example: findAccessibilityNodeInfosByText(String),
findAccessibilityNodeInfosByViewId(String))
perform actions (example: performAction(int))
This is intended for short-lived inspections from testing or debugging tools in the app
process, as operations on this node tree will only succeed as long as the associated
view hierarchy remains attached to a window. AccessibilityNodeInfo objects can
quickly become out of sync with their corresponding View objects; if you wish to
inspect a changed or different view hierarchy then create a new node from any view in that
hierarchy and call this method on that new node, instead of disabling & re-enabling the
connection on the previous node.
Parameters
view
View: The view that generated this node, or any view in the same view-root hierarchy.
This value cannot be null.
enabled
boolean: Whether to enable (true) or disable (false) querying from the app process.
Throws
IllegalStateException
If called from an AccessibilityService, or if provided
a View that is not attached to a window.
setRangeInfo
Added in API level 19
public 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.
setRequestInitialAccessibilityFocus
Added in API level 34
public void setRequestInitialAccessibilityFocus (boolean requestInitialAccessibilityFocus)
Sets whether the node has requested initial accessibility focus.
If the node hasRequestInitialAccessibilityFocus(), this node would be one of
candidates to be accessibility focused when the window appears.
Note: Cannot be called from an
AccessibilityService.
This class is made immutable before being delivered to an AccessibilityService.
Parameters
requestInitialAccessibilityFocus
boolean: True if the node requests to receive initial
accessibility focus.
Throws
IllegalStateException
If called from an AccessibilityService.
setScreenReaderFocusable
Added in API level 28
public void setScreenReaderFocusable (boolean screenReaderFocusable)
Sets whether the node should be considered a focusable unit by a screen reader.
Note: Cannot be called from an
AccessibilityService.
This class is made immutable before being delivered to an AccessibilityService.
This can be used to
group related
content.
Parameters
screenReaderFocusable
boolean: true if the node is a focusable unit for screen readers,
false otherwise.
setScrollable
Added in API level 14
public 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
public 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.
setSelection
Added in version 36.1
public void setSelection (AccessibilityNodeInfo.Selection selection)
Sets the extended selection, which is a representation of selection that spans multiple nodes
that exist within the subtree of the node defining selection.
Note: The start and end SelectionPosition of the provided Selection
should be constructed with this node or a descendant of it.
Note: AccessibilityNodeInfo.setFocusable and
AccessibilityNodeInfo.setFocused should both be called with true
before setting the selection in order to make this node a candidate to
contain a selection.
Note: Cannot be called from an AccessibilityService. This class is made immutable
before being delivered to an AccessibilityService.
Parameters
selection
AccessibilityNodeInfo.Selection: The extended selection within the node's subtree, or null if no
selection exists.
Throws
IllegalStateException
If called from an AccessibilityService
setShowingHintText
Added in API level 26
public 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.
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 API level 14
public 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
public void setSource (View root,
int virtualDescendantId)
Sets the source to be a virtual descendant of the given root.
If virtualDescendantId is View.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.
setStateDescription
Added in API level 30
public void setStateDescription (CharSequence stateDescription)
Sets the state description of this node.
Note: Cannot be called from an
AccessibilityService.
This class is made immutable before being delivered to an AccessibilityService.
Parameters
stateDescription
CharSequence: the state description of this node.
This value may be null.
Throws
IllegalStateException
If called from an AccessibilityService.
setStructuredDataInfo
Added in API level 37
public void setStructuredDataInfo (AccessibilityNodeInfo.StructuredDataInfo info)
Sets additional structured data properties of this node, such as for a mathematical
expression.
Parameters
info
AccessibilityNodeInfo.StructuredDataInfo: The StructuredDataInfo object (e.g., an instance of MathInfo)
describing the node.
This value may be null.
See also:
setSupplementalDescription
Added in API level 36
public void setSupplementalDescription (CharSequence supplementalDescription)
Sets the supplemental description of this node. A supplemental description provides
brief supplemental information for this node, such as the purpose of the node when
that purpose is not conveyed within its textual representation. For example, if a
dropdown select has a purpose of setting font family, the supplemental description
could be "font family". If this node has children, its supplemental description serves
as additional information and is not intended to replace any existing information
in the subtree. This is different from the setContentDescription(CharSequence)
in that this description is purely supplemental while a content description may be used
to replace a description for a node or its subtree that an assistive technology
would otherwise compute based on other properties of the node and its descendants.
Note: Cannot be called from an
AccessibilityService.
This class is made immutable before being delivered to an AccessibilityService.
Parameters
supplementalDescription
CharSequence: The supplemental description.
This value may be null.
Throws
IllegalStateException
If called from an AccessibilityService.
setText
Added in API level 14
public 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.
setTextEntryKey
Added in API level 29
public void setTextEntryKey (boolean isTextEntryKey)
Sets whether the node represents a text entry key that is part of a keyboard or keypad.
Note: Cannot be called from an
AccessibilityService.
This class is made immutable before being delivered to an AccessibilityService.
Parameters
isTextEntryKey
boolean: true if the node is a text entry key, false otherwise.
setTextSelectable
Added in API level 33
public void setTextSelectable (boolean selectableText)
Sets if the node has selectable text.
Note: Cannot be called from an
AccessibilityService.
This class is made immutable before being delivered to an AccessibilityService.
Parameters
selectableText
boolean: True if the node has selectable text, false otherwise.
Throws
IllegalStateException
If called from an AccessibilityService.
setTextSelection
Added in API level 18
public 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
Added in API level 28
public void setTooltipText (CharSequence tooltipText)
Sets the tooltip text of this node.
Note: Cannot be called from an
AccessibilityService.
This class is made immutable before being delivered to an AccessibilityService.
Parameters
tooltipText
CharSequence: The tooltip text.
This value may be null.
Throws
IllegalStateException
If called from an AccessibilityService.
setTouchDelegateInfo
Added in API level 29
public void setTouchDelegateInfo (AccessibilityNodeInfo.TouchDelegateInfo delegatedInfo)
Set touch delegate info if the represented view has a TouchDelegate.
Note: Cannot be called from an
AccessibilityService.
This class is made immutable before being delivered to an
AccessibilityService.
Parameters
delegatedInfo
AccessibilityNodeInfo.TouchDelegateInfo: TouchDelegateInfo returned from
TouchDelegate.getTouchDelegateInfo().
This value cannot be null.
Throws
IllegalStateException
If called from an AccessibilityService.
setTraversalAfter
Added in API level 22
public 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
public 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 View.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
public 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
public 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 View.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.
setUniqueId
Added in API level 33
public void setUniqueId (String uniqueId)
Sets the unique id to act as a key to identify the node. If the node instance is replaced
after refreshing the layout, calling this API to assign the same unique id to the new
alike node can help accessibility service to identify it.
Parameters
uniqueId
String: The unique id that is associated with a visible node on the screen.
This value may be null.
setViewIdResourceName
Added in API level 18
public 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
public 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
public String toString ()
Returns a string representation of the object.
Returns
String
a string representation of the object.
writeToParcel
Added in API level 14
public 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.
This value cannot be null.
flags
int: Additional flags about how the object should be written.
May be 0 or Parcelable.PARCELABLE_WRITE_RETURN_VALUE.
Value is either 0 or a combination of the following:
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2026-03-26 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2026-03-26 UTC."],[],[]]