https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo
AccessibilityNodeInfo
Kotlin |Java
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
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.AccessibilityService
Once an accessibility node info is delivered to an accessibility service it is made immutable and calling a state mutation method generates an error.
Please refer to
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.AccessibilityService
Developer Guides
For more information about making applications accessible, read the Accessibility developer guide.
See also:
Summary
Nested classes | |
---|---|
class | A class defining an action that can be performed on an |
class | Class with information if a node is a collection. |
class | Class with information if a node is a collection item. |
class | Class with information of a view useful to evaluate accessibility needs. |
class | Class with information if a node is a range. |
class | Class with information of touch delegated views and regions from |
Constants | |
---|---|
int | Action that gives accessibility focus to the node. |
| Argument for specifying the collection column to make visible on screen. |
| Argument for whether when moving at granularity to extend the selection or to move it otherwise. |
| Argument for which HTML element to get moving to the next/previous HTML element. |
| Argument for which movement granularity to be used when traversing the node text. |
| Argument for specifying the x coordinate to which to move a window. |
| Argument for specifying the y coordinate to which to move a window. |
| Argument to represent the duration in milliseconds to press and hold a node. |
| Argument for specifying the progress value to set. |
| Argument for specifying the collection row to make visible on screen. |
| Argument for specifying the selection end. |
| Argument for specifying the selection start. |
| Argument for specifying the text content to set. |
int | Action that clears accessibility focus of the node. |
int | Action that clears input focus of the node. |
int | Action that deselects the node. |
int | Action that clicks on the node info. |
int | Action to collapse an expandable node. |
int | Action to copy the current selection to the clipboard. |
int | Action to cut the current selection and place it to the clipboard. |
int | Action to dismiss a dismissable node. |
int | Action to expand an expandable node. |
int | Action that gives input focus to the node. |
int | Action that long clicks on the node. |
int | Action that requests to go to the next entity in this node's text at a given movement granularity. |
int | Action to move to the next HTML element of a given type. |
int | Action to paste the current clipboard content. |
int | Action that requests to go to the previous entity in this node's text at a given movement granularity. |
int | Action to move to the previous HTML element of a given type. |
int | Action to scroll the node content backward. |
int | Action to scroll the node content forward. |
int | Action that selects the node. |
int | Action to set the selection. |
int | Action that sets the text of the node. |
| Key used to request extra data for the rendering information. |
| Integer argument specifying the end index of the requested text location data. |
int | The maximum allowed length of the requested text location data. |
| Integer argument specifying the start index of the requested text location data. |
| Key used to request and locate extra data for text character location. |
int | Prefetching strategy that prefetches the ancestors of the requested node. |
int | Prefetching strategy that prefetches the descendants of the requested node breadth-first. |
int | Prefetching strategy that prefetches the descendants of the requested node depth-first. |
int | Prefetching strategy that prefetches the descendants in a hybrid depth first and breadth first approach. |
int | Prefetching strategy that prefetches the siblings of the requested node. |
int | Prefetching flag that specifies prefetching should not be interrupted by a request to retrieve a node or perform an action on a node. |
int | The accessibility focus. |
int | The input focus. |
int | Maximum batch size of prefetched nodes for a request. |
int | Movement granularity bit for traversing the text of a node by character. |
int | Movement granularity bit for traversing the text of a node by line. |
int | Movement granularity bit for traversing the text of a node by page. |
int | Movement granularity bit for traversing the text of a node by paragraph. |
int | Movement granularity bit for traversing the text of a node by word. |
Inherited constants |
---|
From interface
|
Fields | |
---|---|
public static final | |
Public constructors | |
---|---|
Creates a new | |
Creates a new | |
Creates a new | |
Copy constructor. |
Public methods | |
---|---|
void | This method was deprecated in API level 21. This has been deprecated for |
void | Adds an action that can be performed on the node. |
void | Adds a virtual child which is a descendant of the given |
void | Adds a child. |
boolean | Gets if this node opens a popup or a dialog. |
int | Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. |
boolean | Indicates whether some other object is "equal to" this one. |
| Finds |
| Finds |
| Find the view that has the specified focus type. |
| Searches for the nearest view in the specified direction that can take the input focus. |
| Gets the actions that can be performed on the node. |
int | This method was deprecated in API level 21. Use |
| Get the extra data available for this node. |
void | This method was deprecated in API level 29. Use |
void | Gets the node bounds in screen coordinates. |
| Get the child at given index. |
| Get the child at given index. |
int | Gets the number of children. |
| Gets the class this node comes from. |
| Gets the collection info if the node is a collection. |
| Gets the collection item info if the node is a collection item. |
| Gets the content description of this node. |
int | Get the drawing order of the view corresponding it this node. |
| Gets the error text of this node. |
| Gets the |
| Gets an optional bundle with extra data. |
| Gets the hint text of this node. |
int | Gets the input type of the source as defined by |
| Gets the node info for which the view represented by this info serves as a label for accessibility purposes. |
| Gets the node info which serves as the label of the view represented by this info for accessibility purposes. |
int | Gets the node's live region mode. |
int | Returns the maximum text length for this node. |
int | Gets the movement granularities for traversing the text of this node. |
| Gets the package this node comes from. |
| Get the title of the pane represented by this node. |
| Gets the parent. |
| Gets the parent. |
| Gets the range info if this node is a range. |
| Get the state description of this node. |
| Gets the text of this node. |
int | Gets the text selection end if text is selected. |
int | Gets the text selection start or the cursor position. |
| Gets the tooltip text of this node. |
| Get the |
| Gets the node after which this one is visited in accessibility traversal. |
| Gets the node before which this one is visited during traversal. |
| Gets the unique id of the node. |
| Gets the fully qualified resource name of the source view's id. |
| Gets the window to which this node belongs. |
int | Gets the id of the window from which the info comes from. |
int | Returns a hash code value for the object. |
boolean | Gets whether this node is accessibility focused. |
boolean | Gets whether this node is checkable. |
boolean | Gets whether this node is checked. |
boolean | Gets whether this node is clickable. |
boolean | Gets if the content of this node is invalid. |
boolean | Gets whether this node is context clickable. |
boolean | Gets if the node can be dismissed. |
boolean | Gets if the node is editable. |
boolean | Gets whether this node is enabled. |
boolean | Gets whether this node is focusable. |
boolean | Gets whether this node is focused. |
boolean | Returns whether node represents a heading. |
boolean | Returns whether the node originates from a view considered important for accessibility. |
boolean | Gets whether this node is long clickable. |
boolean | Gets if the node is a multi line editable text. |
boolean | Gets whether this node is a password. |
boolean | Returns whether the node is explicitly marked as a focusable unit by a screen reader. |
boolean | Gets if the node is scrollable. |
boolean | Gets whether this node is selected. |
boolean | Returns whether the node's text represents a hint for the user to enter text. |
boolean | Returns whether node represents a text entry key that is part of a keyboard or keypad. |
boolean | Gets if the node has selectable text. |
boolean | Gets whether this node is visible to the user. |
static | This method was deprecated in API level Tiramisu. Object pooling has been discontinued. Create a new instance using the constructor |
static | This method was deprecated in API level Tiramisu. Object pooling has been discontinued. Create a new instance using the constructor |
static | This method was deprecated in API level Tiramisu. Object pooling has been discontinued. Create a new instance using the constructor |
static | This method was deprecated in API level Tiramisu. Object pooling has been discontinued. Create a new instance using the constructor |
boolean | Performs an action on the node. |
boolean | Performs an action on the node. |
void | This method was deprecated in API level Tiramisu. Object pooling has been discontinued. Calling this function now will have no effect. |
boolean | Refreshes this info with the latest state of the view it represents. |
boolean | Refreshes this info with the latest state of the view it represents, and request new data be added by the View. |
boolean | Removes an action that can be performed on the node. |
void | This method was deprecated in API level 21. Use |
boolean | Removes a virtual child which is a descendant of the given |
boolean | Removes a child. |
void | Sets whether this node is accessibility focused. |
void | Set the extra data available for this node. |
void | This method was deprecated in API level 29. Accessibility services should not care about these bounds. |
void | Sets the node bounds in screen coordinates. |
void | Sets if this node opens a popup or a dialog. |
void | Sets whether this node is checkable. |
void | Sets whether this node is checked. |
void | Sets the class this node comes from. |
void | Sets whether this node is clickable. |
void | Sets the collection info if the node is a collection. |
void | Sets the collection item info if the node is a collection item. |
void | Sets the content description of this node. |
void | Sets if the content of this node is invalid. |
void | Sets whether this node is context clickable. |
void | Sets if the node can be dismissed. |
void | Set the drawing order of the view corresponding it this node. |
void | Sets whether this node is editable. |
void | Sets whether this node is enabled. |
void | Sets the error text of this node. |
void | Sets whether this node is focusable. |
void | Sets whether this node is focused. |
void | Sets whether the node represents a heading. |
void | Sets the hint text of this node. |
void | Sets whether the node is considered important for accessibility. |
void | Sets the input type of the source as defined by |
void | Sets the view for which the view represented by this info serves as a label for accessibility purposes. |
void | Sets the view for which the view represented by this info serves as a label for accessibility purposes. |
void | Sets the view which serves as the label of the view represented by this info for accessibility purposes. |
void | Sets the view which serves as the label of the view represented by this info for accessibility purposes. |
void | Sets the node's live region mode. |
void | Sets whether this node is long clickable. |
void | Sets the maximum text length, or -1 for no limit. |
void | Sets the movement granularities for traversing the text of this node. |
void | Sets if the node is a multi line editable text. |
void | Sets the package this node comes from. |
void | 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 | Sets the parent to be a virtual descendant of the given |
void | Sets the parent. |
void | Sets whether this node is a password. |
void | Sets the range info if this node is a range. |
void | Sets whether the node should be considered a focusable unit by a screen reader. |
void | Sets if the node is scrollable. |
void | Sets whether this node is selected. |
void | Sets whether the node's text represents a hint for the user to enter text. |
void | Sets the source. |
void | Sets the source to be a virtual descendant of the given |
void | Sets the state description of this node. |
void | Sets the text of this node. |
void | Sets whether the node represents a text entry key that is part of a keyboard or keypad. |
void | Sets if the node has selectable text. |
void | Sets the text selection start and end. |
void | Sets the tooltip text of this node. |
void | Set touch delegate info if the represented view has a |
void | Sets the view whose node is visited after this one in accessibility traversal. |
void | Sets the node after which this one is visited in accessibility traversal. |
void | Sets the view before whose node this one should be visited during traversal. |
void | Sets the node before which this one is visited during traversal. |
void | Sets the unique id to act as a key to identify the node. |
void | Sets the fully qualified resource name of the source view's id. |
void | Sets whether this node is visible to the user. |
| Returns a string representation of the object. |
void | Flatten this object in to a Parcel. Note: After the instance is written to a parcel it is recycled. |
Inherited methods | |
---|---|
From class
| |
From interface
|
Constants
ACTION_ACCESSIBILITY_FOCUS
Added in API level 16
public static final int ACTION_ACCESSIBILITY_FOCUS
Action that gives accessibility focus to the node.
Constant Value: 64 (0x00000040)
ACTION_ARGUMENT_COLUMN_INT
Added in API level 23
public static final String ACTION_ARGUMENT_COLUMN_INT
Argument for specifying the collection column to make visible on screen.
Type: int
Actions:
See also:
Constant Value: "android.view.accessibility.action.ARGUMENT_COLUMN_INT"
ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN
Added in API level 18
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:
AccessibilityNodeInfo.AccessibilityAction.ACTION_NEXT_AT_MOVEMENT_GRANULARITY
AccessibilityNodeInfo.AccessibilityAction.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY
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:
AccessibilityNodeInfo.AccessibilityAction.ACTION_NEXT_HTML_ELEMENT
AccessibilityNodeInfo.AccessibilityAction.ACTION_PREVIOUS_HTML_ELEMENT
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:
AccessibilityNodeInfo.AccessibilityAction.ACTION_NEXT_AT_MOVEMENT_GRANULARITY
AccessibilityNodeInfo.AccessibilityAction.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY
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:
See also:
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:
See also:
Constant Value: "android.view.accessibility.action.ARGUMENT_ROW_INT"
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_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.
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.
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 AccessibilityAction#ACTION_CLICK
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.
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.
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:
ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT
ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN
setMovementGranularities(int)
getMovementGranularities()
MOVEMENT_GRANULARITY_CHARACTER
MOVEMENT_GRANULARITY_WORD
MOVEMENT_GRANULARITY_LINE
MOVEMENT_GRANULARITY_PARAGRAPH
MOVEMENT_GRANULARITY_PAGE
Constant Value: 256 (0x00000100)
ACTION_NEXT_HTML_ELEMENT
Added in API level 16
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_STRING
Example:
Bundle arguments = new Bundle(); arguments.putString(AccessibilityNodeInfo.ACTION_ARGUMENT_HTML_ELEMENT_STRING, "BUTTON"); info.performAction(AccessibilityNodeInfo.ACTION_NEXT_HTML_ELEMENT, arguments);
Constant Value: 1024 (0x00000400)
ACTION_PASTE
Added in API level 18
public static final int ACTION_PASTE
Action to paste the current clipboard content.
Constant Value: 32768 (0x00008000)
ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY
Added in API level 16
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_BOOLEAN
Example: Move to the next character and do not extend selection.
Bundle arguments = new Bundle(); arguments.putInt(AccessibilityNodeInfo.ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT, AccessibilityNodeInfo.MOVEMENT_GRANULARITY_CHARACTER); arguments.putBoolean(AccessibilityNodeInfo.ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN, false); info.performAction(AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY, arguments);
See also:
ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT
ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN
setMovementGranularities(int)
getMovementGranularities()
MOVEMENT_GRANULARITY_CHARACTER
MOVEMENT_GRANULARITY_WORD
MOVEMENT_GRANULARITY_LINE
MOVEMENT_GRANULARITY_PARAGRAPH
MOVEMENT_GRANULARITY_PAGE
Constant Value: 512 (0x00000200)
ACTION_PREVIOUS_HTML_ELEMENT
Added in API level 16
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_STRING
Example:
Bundle arguments = new Bundle(); arguments.putString(AccessibilityNodeInfo.ACTION_ARGUMENT_HTML_ELEMENT_STRING, "BUTTON"); info.performAction(AccessibilityNodeInfo.ACTION_PREVIOUS_HTML_ELEMENT, arguments);
Constant Value: 2048 (0x00000800)
ACTION_SCROLL_BACKWARD
Added in API level 16
public static final int ACTION_SCROLL_BACKWARD
Action to scroll the node content backward.
Constant Value: 8192 (0x00002000)
ACTION_SCROLL_FORWARD
Added in API level 16
public static final int ACTION_SCROLL_FORWARD
Action to scroll the node content forward.
Constant Value: 4096 (0x00001000)
ACTION_SELECT
Added in API level 14
public static final int ACTION_SELECT
Action that selects the node.
Constant Value: 4 (0x00000004)
ACTION_SET_SELECTION
Added in API level 18
public static final int ACTION_SET_SELECTION
Action to set the selection. Performing this action with no arguments clears the selection.
Arguments:
, ACTION_ARGUMENT_SELECTION_START_INT
ACTION_ARGUMENT_SELECTION_END_INT
Example:
Bundle arguments = new Bundle(); arguments.putInt(AccessibilityNodeInfo.ACTION_ARGUMENT_SELECTION_START_INT, 1); arguments.putInt(AccessibilityNodeInfo.ACTION_ARGUMENT_SELECTION_END_INT, 2); info.performAction(AccessibilityNodeInfo.ACTION_SET_SELECTION, arguments);
See also:
Constant Value: 131072 (0x00020000)
ACTION_SET_TEXT
Added in API level 21
public static final int ACTION_SET_TEXT
Action that sets the text of the node. Performing the action without argument, using null
or empty
will clear the text. This action will also put the cursor at the end of text.CharSequence
Arguments: ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE
Example:
Bundle arguments = new Bundle(); arguments.putCharSequence(AccessibilityNodeInfo.ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE, "android"); info.performAction(AccessibilityNodeInfo.ACTION_SET_TEXT, arguments);
Constant Value: 2097152 (0x00200000)
EXTRA_DATA_RENDERING_INFO_KEY
Added in API level 30
public static final String EXTRA_DATA_RENDERING_INFO_KEY
Key used to request extra data for the rendering information. The key requests that a
be added to this info. This request is made with AccessibilityNodeInfo.ExtraRenderingInfo
without argument.refreshWithExtraData(java.lang.String, android.os.Bundle)
The data can be retrieved from the
returned by ExtraRenderingInfo
using getExtraRenderingInfo()
, ExtraRenderingInfo#getLayoutSize
and ExtraRenderingInfo#getTextSizeInPx()
. For layout params, it is supported by both ExtraRenderingInfo#getTextSizeUnit()
and TextView
. For text size and unit, it is only supported by ViewGroup
.TextView
See also:
Constant Value: "android.view.accessibility.extra.DATA_RENDERING_INFO_KEY"
EXTRA_DATA_TEXT_CHARACTER_LOCATION_ARG_LENGTH
Added in API level 26
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_LENGTH
See also:
Constant Value: "android.view.accessibility.extra.DATA_TEXT_CHARACTER_LOCATION_ARG_LENGTH"
EXTRA_DATA_TEXT_CHARACTER_LOCATION_ARG_MAX_LENGTH
Added in API level 31
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)
EXTRA_DATA_TEXT_CHARACTER_LOCATION_ARG_START_INDEX
Added in API level 26
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"
EXTRA_DATA_TEXT_CHARACTER_LOCATION_KEY
Added in API level 26
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
s be added to the extras. This request is made with RectF
. The arguments taken by this request are two integers: refreshWithExtraData(java.lang.String, android.os.Bundle)
and EXTRA_DATA_TEXT_CHARACTER_LOCATION_ARG_START_INDEX
. The starting index must be valid inside the CharSequence returned by EXTRA_DATA_TEXT_CHARACTER_LOCATION_ARG_LENGTH
, and the length must be positive.getText()
The data can be retrieved from the Bundle
returned by
using this string as a key for getExtras()
. The Bundle#getParcelableArray(String)
will be null for characters that either do not exist or are off the screen.RectF
See also:
Constant Value: "android.view.accessibility.extra.DATA_TEXT_CHARACTER_LOCATION_KEY"
FLAG_PREFETCH_ANCESTORS
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:
getChild(int, int)
getParent(int)
AccessibilityWindowInfo.getRoot(int)
AccessibilityService.getRootInActiveWindow(int)
AccessibilityRecord.getSource(int)
Constant Value: 1 (0x00000001)
FLAG_PREFETCH_DESCENDANTS_BREADTH_FIRST
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
or FLAG_PREFETCH_DESCENDANTS_HYBRID
or this will trigger an IllegalArgumentException.FLAG_PREFETCH_DESCENDANTS_DEPTH_FIRST
See also:
Constant Value: 16 (0x00000010)
FLAG_PREFETCH_DESCENDANTS_DEPTH_FIRST
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
or FLAG_PREFETCH_DESCENDANTS_HYBRID
or this will trigger an IllegalArgumentException.FLAG_PREFETCH_DESCENDANTS_BREADTH_FIRST
See also:
Constant Value: 8 (0x00000008)
FLAG_PREFETCH_DESCENDANTS_HYBRID
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
or FLAG_PREFETCH_DESCENDANTS_DEPTH_FIRST
or this will trigger an IllegalArgumentException.FLAG_PREFETCH_DESCENDANTS_BREADTH_FIRST
See also:
Constant Value: 4 (0x00000004)
FLAG_PREFETCH_SIBLINGS
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 also:
Constant Value: 2 (0x00000002)
FLAG_PREFETCH_UNINTERRUPTIBLE
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 also:
Constant Value: 32 (0x00000020)
FOCUS_ACCESSIBILITY
Added in API level 16
public static final int FOCUS_ACCESSIBILITY
The accessibility focus.
Constant Value: 2 (0x00000002)
FOCUS_INPUT
Added in API level 16
public static final int FOCUS_INPUT
The input focus.
Constant Value: 1 (0x00000001)
MAX_NUMBER_OF_PREFETCHED_NODES
public static final int MAX_NUMBER_OF_PREFETCHED_NODES
Maximum batch size of prefetched nodes for a request.
Constant Value: 50 (0x00000032)
MOVEMENT_GRANULARITY_CHARACTER
Added in API level 16
public static final int MOVEMENT_GRANULARITY_CHARACTER
Movement granularity bit for traversing the text of a node by character.
Constant Value: 1 (0x00000001)
MOVEMENT_GRANULARITY_LINE
Added in API level 16
public static final int MOVEMENT_GRANULARITY_LINE
Movement granularity bit for traversing the text of a node by line.
Constant Value: 4 (0x00000004)
MOVEMENT_GRANULARITY_PAGE
Added in API level 16
public static final int MOVEMENT_GRANULARITY_PAGE
Movement granularity bit for traversing the text of a node by page.
Constant Value: 16 (0x00000010)
MOVEMENT_GRANULARITY_PARAGRAPH
Added in API level 16
public static final int MOVEMENT_GRANULARITY_PARAGRAPH
Movement granularity bit for traversing the text of a node by paragraph.
Constant Value: 8 (0x00000008)
MOVEMENT_GRANULARITY_WORD
Added in API level 16
public static final int MOVEMENT_GRANULARITY_WORD
Movement granularity bit for traversing the text of a node by word.
Constant Value: 2 (0x00000002)
Fields
CREATOR
Added in API level 14
public static final Creator<AccessibilityNodeInfo> CREATOR
See also:
Public constructors
AccessibilityNodeInfo
Added in API level 30
public AccessibilityNodeInfo ()
Creates a new
.AccessibilityNodeInfo
AccessibilityNodeInfo
Added in API level 30
public AccessibilityNodeInfo (View source)
Creates a new
with the given AccessibilityNodeInfo
source
.
Parameters | |
---|---|
source | View : The source view. This value cannot be null . |
AccessibilityNodeInfo
Added in API level 30
public AccessibilityNodeInfo (View root, int virtualDescendantId)
Creates a new
with the given AccessibilityNodeInfo
source
.
Parameters | |
---|---|
root | View : The root of the virtual subtree. This value cannot be null . |
virtualDescendantId | int : The id of the virtual descendant. |
AccessibilityNodeInfo
Added in API level 30
public AccessibilityNodeInfo (AccessibilityNodeInfo info)
Copy constructor. Creates a new
, and this new instance is initialized from the given AccessibilityNodeInfo
info
.
Parameters | |
---|---|
info | AccessibilityNodeInfo : The other info. This value cannot be null . |
Public methods
addAction
Added in API level 14
Deprecated in API level 21
public void addAction (int action)
This method was deprecated in API level 21.
This has been deprecated for addAction(android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction)
Adds an action that can be performed on the node.
Note: Cannot be called from an
. This class is made immutable before being delivered to an AccessibilityService.AccessibilityService
Parameters | |
---|---|
action | int : The action. |
Throws | |
---|---|
| If called from an AccessibilityService. |
| If the argument is not one of the standard actions. |
addAction
Added in API level 21
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
. 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 AccessibilityAction
and an optional label that describes the action.ACTION_CLICK
Note: Cannot be called from an
. This class is made immutable before being delivered to an AccessibilityService.AccessibilityService
Parameters | |
---|---|
action | AccessibilityNodeInfo.AccessibilityAction : The action. |
Throws | |
---|---|
| If called from an AccessibilityService. |
addChild
Added in API level 16
public void addChild (View root, int virtualDescendantId)
Adds a virtual child which is a descendant of the given root
. If virtualDescendantId
is
the root is added as a child.View#NO_ID
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. |
addChild
Added in API level 14
public void addChild (View child)
Adds a child.
Note: Cannot be called from an
. This class is made immutable before being delivered to an AccessibilityService. Note that a view cannot be made its own child.AccessibilityService
Parameters | |
---|---|
child | View : The child. |
Throws | |
---|---|
| If called from an AccessibilityService. |
canOpenPopup
Added in API level 19
public boolean canOpenPopup ()
Gets if this node opens a popup or a dialog.
Returns | |
---|---|
boolean | If the the node opens a popup. |
describeContents
Added in API level 14
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
, the return value of this method must include the writeToParcel(android.os.Parcel, int)
bit.CONTENTS_FILE_DESCRIPTOR
Returns | |
---|---|
int | a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either 0 or |
equals
Added in API level 14
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:
- It is reflexive: for any non-null reference value
x
,x.equals(x)
should returntrue
. - It is symmetric: for any non-null reference values
x
andy
,x.equals(y)
should returntrue
if and only ify.equals(x)
returnstrue
. - It is transitive: for any non-null reference values
x
,y
, andz
, ifx.equals(y)
returnstrue
andy.equals(z)
returnstrue
, thenx.equals(z)
should returntrue
. - It is consistent: for any non-null reference values
x
andy
, multiple invocations ofx.equals(y)
consistently returntrue
or consistently returnfalse
, provided no information used inequals
comparisons on the objects is modified. - For any non-null reference value
x
,x.equals(null)
should returnfalse
.
The equals
method for class Object
implements the most discriminating possible equivalence relation on objects; that is, for any non-null reference values x
and y
, this method returns true
if and only if x
and y
refer to the same object (x == y
has the value true
).
Note that it is generally necessary to override the hashCode
method whenever this method is overridden, so as to maintain the general contract for the hashCode
method, which states that equal objects must have equal hash codes.
Parameters | |
---|---|
object | Object : This value may be null . |
Returns | |
---|---|
boolean | true if this object is the same as the obj argument; false otherwise. |
findAccessibilityNodeInfosByText
Added in API level 14
public List<AccessibilityNodeInfo> findAccessibilityNodeInfosByText (String text)
Finds
s 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.AccessibilityNodeInfo
Note: It is a client responsibility to recycle the received info by calling
to avoid creating of multiple instances.AccessibilityNodeInfo#recycle()
Note: If this view hierarchy has a
embedding another view hierarchy via SurfaceView
, 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.SurfaceView#setChildSurfacePackage
Parameters | |
---|---|
text | String : The searched text. |
Returns | |
---|---|
| A list of node info. |
findAccessibilityNodeInfosByViewId
Added in API level 18
public List<AccessibilityNodeInfo> findAccessibilityNodeInfosByViewId (String viewId)
Finds
s 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".AccessibilityNodeInfo
Note: It is a client responsibility to recycle the received info by calling
to avoid creating of multiple instances.AccessibilityNodeInfo#recycle()
Note: The primary usage of this API is for UI test automation and in order to report the fully qualified view id if an
the client has to set the AccessibilityNodeInfo
flag when configuring the AccessibilityServiceInfo#FLAG_REPORT_VIEW_IDS
.AccessibilityService
Note: If this view hierarchy has a
embedding another view hierarchy via SurfaceView
, 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.SurfaceView#setChildSurfacePackage
Parameters | |
---|---|
viewId | String : The fully qualified resource name of the view id to find. This value cannot be null . |
Returns | |
---|---|
| A list of node info. |
findFocus
Added in API level 16
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
embedding another view hierarchy via SurfaceView
, 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 SurfaceView#setChildSurfacePackage
for AccessibilityService#findFocus(int)
only since it has no such limitation.FOCUS_ACCESSIBILITY
Parameters | |
---|---|
focus | int : The focus to find. One of or . |
Returns | |
---|---|
| The node info of the focused view or null. |
See also:
focusSearch
Added in API level 16
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
embedding another view hierarchy via SurfaceView
, 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.SurfaceView#setChildSurfacePackage
Parameters | |
---|---|
direction | int : The direction. Can be one of: , , , , , . |
Returns | |
---|---|
| The node info for the view that can take accessibility focus. |
getActionList
Added in API level 21
public List<AccessibilityNodeInfo.AccessibilityAction> getActionList ()
Gets the actions that can be performed on the node.
Returns | |
---|---|
|
getActions
Added in API level 14
Deprecated in API level 21
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:
ACTION_FOCUS
ACTION_CLEAR_FOCUS
ACTION_SELECT
ACTION_CLEAR_SELECTION
ACTION_ACCESSIBILITY_FOCUS
ACTION_CLEAR_ACCESSIBILITY_FOCUS
ACTION_CLICK
ACTION_LONG_CLICK
ACTION_NEXT_AT_MOVEMENT_GRANULARITY
ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY
ACTION_NEXT_HTML_ELEMENT
ACTION_PREVIOUS_HTML_ELEMENT
ACTION_SCROLL_FORWARD
ACTION_SCROLL_BACKWARD
getAvailableExtraData
Added in API level 26
public 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(java.lang.String, android.os.Bundle)
Returns | |
---|---|
| An unmodifiable list of keys corresponding to extra data that can be requested. |
See also:
getBoundsInParent
Added in API level 14
Deprecated in API level 29
public void getBoundsInParent (Rect outBounds)
This method was deprecated in API level 29.
Use
instead.getBoundsInScreen(android.graphics.Rect)
Gets the node bounds in the viewParent's coordinates.
does not represent the source's viewParent. Instead it represents the result of getParent()
, which returns the closest ancestor where View#getParentForAccessibility()
is true. So this method is not reliable.View#isImportantForAccessibility()
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. |
getBoundsInScreen
Added in API level 14
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. |
getChild
Added in API level 14
public AccessibilityNodeInfo getChild (int index)
Get the child at given index.
Parameters | |
---|---|
index | int : The child index. |
Returns | |
---|---|
| The child node. |
Throws | |
---|---|
| If called outside of an AccessibilityService. |
getChild
public AccessibilityNodeInfo getChild (int index, int prefetchingStrategy)
Get the child at given index.
Parameters | |
---|---|
index | int : The child index. |
prefetchingStrategy | int : the prefetching strategy. Value is either 0 or a combination of , , , , , and |
Returns | |
---|---|
| The child node. This value may be null . |
Throws | |
---|---|
| If called outside of an AccessibilityService. |
See also:
getChildCount
Added in API level 14
public int getChildCount ()
Gets the number of children.
Returns | |
---|---|
int | The child count. |
getClassName
Added in API level 14
public CharSequence getClassName ()
Gets the class this node comes from.
Returns | |
---|---|
| The class name. |
getCollectionInfo
Added in API level 19
public AccessibilityNodeInfo.CollectionInfo getCollectionInfo ()
Gets the collection info if the node is a collection. A collection child is always a collection item.
Returns | |
---|---|
| The collection info. |
getCollectionItemInfo
Added in API level 19
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 | |
---|---|
| The collection item info. |
getContentDescription
Added in API level 14
public CharSequence getContentDescription ()
Gets the content description of this node.
Returns | |
---|---|
| The content description. |
getDrawingOrder
Added in API level 24
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. |
getError
Added in API level 21
public CharSequence getError ()
Gets the error text of this node.
Returns | |
---|---|
| The error text. |
getExtraRenderingInfo
Added in API level 30
public AccessibilityNodeInfo.ExtraRenderingInfo getExtraRenderingInfo ()
Gets the
if the node is meant to be refreshed with extra data to examine rendering related accessibility issues.extra rendering info
Returns | |
---|---|
| The . This value may be null . |
See also:
getExtras
Added in API level 19
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 | |
---|---|
| The bundle. |
getHintText
Added in API level 26
public CharSequence getHintText ()
Gets the hint text of this node. Only applies to nodes where text can be entered.
Returns | |
---|---|
| The hint text. |
getInputType
Added in API level 19
public int getInputType ()
Gets the input type of the source as defined by
.InputType
Returns | |
---|---|
int | The input type. |
getLabelFor
Added in API level 17
public AccessibilityNodeInfo getLabelFor ()
Gets the node info for which the view represented by this info serves as a label for accessibility purposes.
Note: It is a client responsibility to recycle the received info by calling
to avoid creating of multiple instances.AccessibilityNodeInfo#recycle()
Returns | |
---|---|
| The labeled info. |
getLabeledBy
Added in API level 17
public AccessibilityNodeInfo getLabeledBy ()
Gets the node info which serves as the label of the view represented by this info for accessibility purposes.
Note: It is a client responsibility to recycle the received info by calling
to avoid creating of multiple instances.AccessibilityNodeInfo#recycle()
Returns | |
---|---|
| The label. |
getLiveRegion
Added in API level 19
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, in a login screen with a TextView that displays an "incorrect password" notification, that view should be marked as a live region with mode
.View#ACCESSIBILITY_LIVE_REGION_POLITE
It is the responsibility of the accessibility service to monitor
events indicating changes to live region nodes and their children.AccessibilityEvent#TYPE_WINDOW_CONTENT_CHANGED
Returns | |
---|---|
int | The live region mode, or if the view is not a live region. |
See also:
getMaxTextLength
Added in API level 21
public int getMaxTextLength ()
Returns the maximum text length for this node.
Returns | |
---|---|
int | The maximum text length, or -1 for no limit. |
See also:
getMovementGranularities
Added in API level 16
public int getMovementGranularities ()
Gets the movement granularities for traversing the text of this node.
Returns | |
---|---|
int | The bit mask with granularities. |
getPackageName
Added in API level 14
public CharSequence getPackageName ()
Gets the package this node comes from.
Returns | |
---|---|
| The package name. |
getPaneTitle
Added in API level 28
public CharSequence getPaneTitle ()
Get the title of the pane represented by this node.
Returns | |
---|---|
| The title of the pane represented by this node, or null if this node does not represent a pane. |
getParent
Added in API level 14
public AccessibilityNodeInfo getParent ()
Gets the parent.
Returns | |
---|---|
| The parent. |
getParent
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
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 getParent()
nodes is reached. To prevent interruption by another request and to force prefetching of the max batch size, use MAX_NUMBER_OF_PREFETCHED_NODES
.AccessibilityNodeInfo#FLAG_PREFETCH_UNINTERRUPTIBLE
Parameters | |
---|---|
prefetchingStrategy | int : the prefetching strategy. Value is either 0 or a combination of , , , , , and |
Returns | |
---|---|
| The parent. This value may be null . |
Throws | |
---|---|
| If called outside of an AccessibilityService. |
See also:
FLAG_PREFETCH_ANCESTORS
FLAG_PREFETCH_DESCENDANTS_BREADTH_FIRST
FLAG_PREFETCH_DESCENDANTS_DEPTH_FIRST
FLAG_PREFETCH_DESCENDANTS_HYBRID
FLAG_PREFETCH_SIBLINGS
FLAG_PREFETCH_UNINTERRUPTIBLE
getRangeInfo
Added in API level 19
public AccessibilityNodeInfo.RangeInfo getRangeInfo ()
Gets the range info if this node is a range.
Returns | |
---|---|
| The range. |
getStateDescription
Added in API level 30
public CharSequence getStateDescription ()
Get the state description of this node.
Returns | |
---|---|
| the state description This value may be null . |
getText
Added in API level 14
public CharSequence getText ()
Gets the text of this node.
Note: If the text contains
s or ClickableSpan
s, these spans will have been replaced with ones whose URLSpan
can be called from an ClickableSpan#onClick(View)
. When called from a service, the AccessibilityService
argument is ignored and the corresponding span will be found on the view that this View
AccessibilityNodeInfo
represents and called with that view as its argument.
This treatment of
s means that the text returned from this method may different slightly one passed to ClickableSpan
, although they will be equivalent according to setText(java.lang.CharSequence)
. The TextUtils#equals(CharSequence, CharSequence)
of any spans, however, will generally not work outside of an accessibility service.ClickableSpan#onClick(View)
Returns | |
---|---|
| The text. |
getTextSelectionEnd
Added in API level 18
public int getTextSelectionEnd ()
Gets the text selection end if text is selected.
If no text is selected, both this method and
return the same value: the current location of the cursor.AccessibilityNodeInfo#getTextSelectionStart()
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. |
getTextSelectionStart
Added in API level 18
public int getTextSelectionStart ()
Gets the text selection start or the cursor position.
If no text is selected, both this method and
return the same value: the current location of the cursor.AccessibilityNodeInfo#getTextSelectionEnd()
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. |
getTooltipText
Added in API level 28
public CharSequence getTooltipText ()
Gets the tooltip text of this node.
Returns | |
---|---|
| The tooltip text. This value may be null . |
getTouchDelegateInfo
Added in API level 29
public AccessibilityNodeInfo.TouchDelegateInfo getTouchDelegateInfo ()
Get the
for touch delegate behavior with the represented view. It is possible for the same node to be pointed to by several regions. Use TouchDelegateInfo
to get touch delegate target TouchDelegateInfo#getRegionAt(int)
, and Region
for TouchDelegateInfo#getTargetForRegion(Region)
from the given region.AccessibilityNodeInfo
Returns | |
---|---|
| or null if there are no touch delegates. |
getTraversalAfter
Added in API level 22
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 | |
---|---|
| The succeeding node if such or null . |
See also:
getTraversalBefore
Added in API level 22
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 | |
---|---|
| The succeeding node if such or null . |
See also:
getUniqueId
public String getUniqueId ()
Gets the unique id of the node.
Returns | |
---|---|
| The unique id This value may be null . |
getViewIdResourceName
Added in API level 18
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
the client has to set the AccessibilityNodeInfo
flag when configuring the AccessibilityServiceInfo#FLAG_REPORT_VIEW_IDS
.AccessibilityService
Returns | |
---|---|
| The id resource name. |
getWindow
Added in API level 21
public AccessibilityWindowInfo getWindow ()
Gets the window to which this node belongs.
Returns | |
---|---|
| The window. |
See also:
getWindowId
Added in API level 14
public int getWindowId ()
Gets the id of the window from which the info comes from.
Returns | |
---|---|
int | The window id. |
hashCode
Added in API level 14
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:
- Whenever it is invoked on the same object more than once during an execution of a Java application, the
hashCode
method must consistently return the same integer, provided no information used inequals
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. - If two objects are equal according to the
equals(Object)
method, then calling thehashCode
method on each of the two objects must produce the same integer result. - It is not required that if two objects are unequal according to the
method, then calling theequals(java.lang.Object)
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.
As much as is reasonably practical, the hashCode method defined by class Object
does return distinct integers for distinct objects. (This is typically implemented by converting the internal address of the object into an integer, but this implementation technique is not required by the Java™ programming language.)
Returns | |
---|---|
int | a hash code value for this object. |
isAccessibilityFocused
Added in API level 16
public boolean isAccessibilityFocused ()
Gets whether this node is accessibility focused.
Returns | |
---|---|
boolean | True if the node is accessibility focused. |
isCheckable
Added in API level 14
public boolean isCheckable ()
Gets whether this node is checkable.
Returns | |
---|---|
boolean | True if the node is checkable. |
isChecked
Added in API level 14
public boolean isChecked ()
Gets whether this node is checked.
Returns | |
---|---|
boolean | True if the node is checked. |
isClickable
Added in API level 14
public boolean isClickable ()
Gets whether this node is clickable.
Returns | |
---|---|
boolean | True if the node is clickable. |
isContentInvalid
Added in API level 19
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. |
isContextClickable
Added in API level 23
public boolean isContextClickable ()
Gets whether this node is context clickable.
Returns | |
---|---|
boolean | True if the node is context clickable. |
isDismissable
Added in API level 19
public boolean isDismissable ()
Gets if the node can be dismissed.
Returns | |
---|---|
boolean | If the node can be dismissed. |
isEditable
Added in API level 18
public boolean isEditable ()
Gets if the node is editable.
Returns | |
---|---|
boolean | True if the node is editable, false otherwise. |
isEnabled
Added in API level 14
public boolean isEnabled ()
Gets whether this node is enabled.
Returns | |
---|---|
boolean | True if the node is enabled. |
isFocusable
Added in API level 14
public boolean isFocusable ()
Gets whether this node is focusable.
Returns | |
---|---|
boolean | True if the node is focusable. |
isFocused
Added in API level 14
public boolean isFocused ()
Gets whether this node is focused.
Returns | |
---|---|
boolean | True if the node is focused. |
isHeading
Added in API level 28
public boolean isHeading ()
Returns whether node represents a heading.
Note: Returns true
if either
marks this node as a heading or if the node has a setHeading(boolean)
that marks it as such, to accomodate apps that use the now-deprecated API.CollectionItemInfo
Returns | |
---|---|
boolean | true if the node is a heading, false otherwise. |
isImportantForAccessibility
Added in API level 24
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:
isLongClickable
Added in API level 14
public boolean isLongClickable ()
Gets whether this node is long clickable.
Returns | |
---|---|
boolean | True if the node is long clickable. |
isMultiLine
Added in API level 19
public boolean isMultiLine ()
Gets if the node is a multi line editable text.
Returns | |
---|---|
boolean | True if the node is multi line. |
isPassword
Added in API level 14
public boolean isPassword ()
Gets whether this node is a password.
Returns | |
---|---|
boolean | True if the node is a password. |
isScreenReaderFocusable
Added in API level 28
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
, or the presence of text in a node, to determine what should receive focus.isFocusable()
Returns | |
---|---|
boolean | true if the node is specifically marked as a focusable unit for screen readers, false otherwise. |
See also:
isScrollable
Added in API level 14
public boolean isScrollable ()
Gets if the node is scrollable.
Returns | |
---|---|
boolean | True if the node is scrollable, false otherwise. |
isSelected
Added in API level 14
public boolean isSelected ()
Gets whether this node is selected.
Returns | |
---|---|
boolean | True if the node is selected. |
isShowingHintText
Added in API level 26
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. |
isTextEntryKey
Added in API level 29
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. |
isTextSelectable
public boolean isTextSelectable ()
Gets if the node has selectable text.
Services should use
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.ACTION_SET_SELECTION
Returns | |
---|---|
boolean | True if the node has selectable text. |
See also:
isVisibleToUser
Added in API level 16
public boolean isVisibleToUser ()
Gets whether this node is visible to the user.
Between
and API 16
, 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.API 29
Returns | |
---|---|
boolean | Whether the node is visible to the user. |
obtain
Added in API level 16
Deprecated in API level Tiramisu
public static AccessibilityNodeInfo obtain (View root, int virtualDescendantId)
This method was deprecated in API level Tiramisu.
Object pooling has been discontinued. Create a new instance using the constructor
instead.AccessibilityNodeInfo(android.view.View, int)
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 | |
---|---|
| An instance. |
See also:
obtain
Added in API level 14
Deprecated in API level Tiramisu
public static AccessibilityNodeInfo obtain (AccessibilityNodeInfo info)
This method was deprecated in API level Tiramisu.
Object pooling has been discontinued. Create a new instance using the constructor
instead.AccessibilityNodeInfo(android.view.accessibility.AccessibilityNodeInfo)
Instantiates a new AccessibilityNodeInfo initialized from the given info
.
Parameters | |
---|---|
info | AccessibilityNodeInfo : The other info. |
Returns | |
---|---|
| An instance. |
obtain
Added in API level 14
Deprecated in API level Tiramisu
public static AccessibilityNodeInfo obtain ()
This method was deprecated in API level Tiramisu.
Object pooling has been discontinued. Create a new instance using the constructor
instead.AccessibilityNodeInfo()
Instantiates a new AccessibilityNodeInfo.
Returns | |
---|---|
| An instance. |
obtain
Added in API level 14
Deprecated in API level Tiramisu
public static AccessibilityNodeInfo obtain (View source)
This method was deprecated in API level Tiramisu.
Object pooling has been discontinued. Create a new instance using the constructor
instead.AccessibilityNodeInfo(android.view.View)
Returns a cached instance if such is available otherwise a new one and sets the source.
Parameters | |
---|---|
source | View : The source view. |
Returns | |
---|---|
| An instance. |
See also:
performAction
Added in API level 16
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 | |
---|---|
| If called outside of an AccessibilityService. |
performAction
Added in API level 14
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 | |
---|---|
| If called outside of an AccessibilityService. |
recycle
Added in API level 14
Deprecated in API level Tiramisu
public void recycle ()
This method was deprecated in API level Tiramisu.
Object pooling has been discontinued. Calling this function now will have no effect.
Would previously return an instance back to be reused.
refresh
Added in API level 18
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 represented by this node is no longer in the view tree (and thus this node is obsolete and should be recycled). |
refreshWithExtraData
Added in API level 26
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 , , and . |
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 represented by this node is no longer in the view tree (and thus this node is obsolete and should be recycled). |
removeAction
Added in API level 21
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
. This class is made immutable before being delivered to an AccessibilityService.AccessibilityService
Parameters | |
---|---|
action | AccessibilityNodeInfo.AccessibilityAction : The action to be removed. |
Returns | |
---|---|
boolean | The action removed from the list of actions. |
Throws | |
---|---|
| If called from an AccessibilityService. |
removeAction
Added in API level 21
Deprecated in API level 21
public void removeAction (int action)
This method was deprecated in API level 21.
Use removeAction(android.view.accessibility.AccessibilityNodeInfo.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
. This class is made immutable before being delivered to an AccessibilityService.AccessibilityService
Parameters | |
---|---|
action | int : The action to be removed. |
Throws | |
---|---|
| If called from an AccessibilityService. |
removeChild
Added in API level 21
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:
removeChild
Added in API level 21
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
. This class is made immutable before being delivered to an AccessibilityService.AccessibilityService
Parameters | |
---|---|
child | View : The child. |
Returns | |
---|---|
boolean | true if the child was present |
Throws | |
---|---|
| If called from an AccessibilityService. |
setAccessibilityFocused
Added in API level 16
public void setAccessibilityFocused (boolean focused)
Sets whether this node is accessibility focused.
Note: Cannot be called from an
. This class is made immutable before being delivered to an AccessibilityService.AccessibilityService
Parameters | |
---|---|
focused | boolean : True if the node is accessibility focused. |
Throws | |
---|---|
| If called from an AccessibilityService. |
setAvailableExtraData
Added in API level 26
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
. This class is made immutable before being delivered to an AccessibilityService.AccessibilityService
Parameters | |
---|---|
extraDataKeys | List : A list of types of extra data that are available. |
Throws | |
---|---|
| If called from an AccessibilityService. |
See also:
setBoundsInParent
Added in API level 14
Deprecated in API level 29
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.
does not represent the source's viewParent. Instead it represents the result of getParent()
, which returns the closest ancestor where View#getParentForAccessibility()
is true. So this method is not reliable.View#isImportantForAccessibility()
Note: Cannot be called from an
. This class is made immutable before being delivered to an AccessibilityService.AccessibilityService
Parameters | |
---|---|
bounds | Rect : The node bounds. |
Throws | |
---|---|
| If called from an AccessibilityService. |
setBoundsInScreen
Added in API level 14
public void setBoundsInScreen (Rect bounds)
Sets the node bounds in screen coordinates.
Note: Cannot be called from an
. This class is made immutable before being delivered to an AccessibilityService.AccessibilityService
Parameters | |
---|---|
bounds | Rect : The node bounds. |
Throws | |
---|---|
| If called from an AccessibilityService. |
setCanOpenPopup
Added in API level 19
public void setCanOpenPopup (boolean opensPopup)
Sets if this node opens a popup or a dialog.
Note: Cannot be called from an
. This class is made immutable before being delivered to an AccessibilityService.AccessibilityService
Parameters | |
---|---|
opensPopup | boolean : If the the node opens a popup. |
setCheckable
Added in API level 14
public void setCheckable (boolean checkable)
Sets whether this node is checkable.
Note: Cannot be called from an
. This class is made immutable before being delivered to an AccessibilityService.AccessibilityService
Parameters | |
---|---|
checkable | boolean : True if the node is checkable. |
Throws | |
---|---|
| If called from an AccessibilityService. |
setChecked
Added in API level 14
public void setChecked (boolean checked)
Sets whether this node is checked.
Note: Cannot be called from an
. This class is made immutable before being delivered to an AccessibilityService.AccessibilityService
Parameters | |
---|---|
checked | boolean : True if the node is checked. |
Throws | |
---|---|
| If called from an AccessibilityService. |
setClassName
Added in API level 14
public void setClassName (CharSequence className)
Sets the class this node comes from.
Note: Cannot be called from an
. This class is made immutable before being delivered to an AccessibilityService.AccessibilityService
Parameters | |
---|---|
className | CharSequence : The class name. |
Throws | |
---|---|
| If called from an AccessibilityService. |
setClickable
Added in API level 14
public void setClickable (boolean clickable)
Sets whether this node is clickable.
Note: Cannot be called from an
. This class is made immutable before being delivered to an AccessibilityService.AccessibilityService
Parameters | |
---|---|
clickable | boolean : True if the node is clickable. |
Throws | |
---|---|
| If called from an AccessibilityService. |
setCollectionInfo
Added in API level 19
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
. This class is made immutable before being delivered to an AccessibilityService.AccessibilityService
Parameters | |
---|---|
collectionInfo | AccessibilityNodeInfo.CollectionInfo : The collection info. |
setCollectionItemInfo
Added in API level 19
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
. This class is made immutable before being delivered to an AccessibilityService.AccessibilityService
Parameters | |
---|---|
collectionItemInfo | AccessibilityNodeInfo.CollectionItemInfo |
setContentDescription
Added in API level 14
public void setContentDescription (CharSequence contentDescription)
Sets the content description of this node.
Note: Cannot be called from an
. This class is made immutable before being delivered to an AccessibilityService.AccessibilityService
Parameters | |
---|---|
contentDescription | CharSequence : The content description. |
Throws | |
---|---|
| If called from an AccessibilityService. |
setContentInvalid
Added in API level 19
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
. This class is made immutable before being delivered to an AccessibilityService.AccessibilityService
Parameters | |
---|---|
contentInvalid | boolean : If the node content is invalid. |
setContextClickable
Added in API level 23
public void setContextClickable (boolean contextClickable)
Sets whether this node is context clickable.
Note: Cannot be called from an
. This class is made immutable before being delivered to an AccessibilityService.AccessibilityService
Parameters | |
---|---|
contextClickable | boolean : True if the node is context clickable. |
Throws | |
---|---|
| If called from an AccessibilityService. |
setDismissable
Added in API level 19
public void setDismissable (boolean dismissable)
Sets if the node can be dismissed.
Note: Cannot be called from an
. This class is made immutable before being delivered to an AccessibilityService.AccessibilityService
Parameters | |
---|---|
dismissable | boolean : If the node can be dismissed. |
setDrawingOrder
Added in API level 24
public void setDrawingOrder (int drawingOrderInParent)
Set the drawing order of the view corresponding it this node.
Note: Cannot be called from an
. This class is made immutable before being delivered to an AccessibilityService.AccessibilityService
Throws | |
---|---|
| If called from an AccessibilityService. |
setEditable
Added in API level 18
public void setEditable (boolean editable)
Sets whether this node is editable.
Note: Cannot be called from an
. This class is made immutable before being delivered to an AccessibilityService.AccessibilityService
Parameters | |
---|---|
editable | boolean : True if the node is editable. |
Throws | |
---|---|
| If called from an AccessibilityService. |
setEnabled
Added in API level 14
public void setEnabled (boolean enabled)
Sets whether this node is enabled.
Note: Cannot be called from an
. This class is made immutable before being delivered to an AccessibilityService.AccessibilityService
Parameters | |
---|---|
enabled | boolean : True if the node is enabled. |
Throws | |
---|---|
| If called from an AccessibilityService. |
setError
Added in API level 21
public void setError (CharSequence error)
Sets the error text of this node.
Note: Cannot be called from an
. This class is made immutable before being delivered to an AccessibilityService.AccessibilityService
Parameters | |
---|---|
error | CharSequence : The error text. |
Throws | |
---|---|
| 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
. This class is made immutable before being delivered to an AccessibilityService.AccessibilityService
Parameters | |
---|---|
focusable | boolean : True if the node is focusable. |
Throws | |
---|---|
| 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
. This class is made immutable before being delivered to an AccessibilityService.AccessibilityService
Parameters | |
---|---|
focused | boolean : True if the node is focused. |
Throws | |
---|---|
| 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
. This class is made immutable before being delivered to an AccessibilityService.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
. This class is made immutable before being delivered to an AccessibilityService.AccessibilityService
Parameters | |
---|---|
hintText | CharSequence : The hint text for this mode. |
Throws | |
---|---|
| 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
. This class is made immutable before being delivered to an AccessibilityService.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
. This class is made immutable before being delivered to an AccessibilityService.AccessibilityService
Parameters | |
---|---|
inputType | int : The input type. |
Throws | |
---|---|
| If called from an AccessibilityService. |
setLabelFor
Added in API level 17
public void setLabelFor (View root, int virtualDescendantId)
Sets the view for which the view represented by this info serves as a label for accessibility purposes. If virtualDescendantId
is
the root is set as the labeled.View#NO_ID
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
. This class is made immutable before being delivered to an AccessibilityService.AccessibilityService
Parameters | |
---|---|
root | View : The root whose virtual descendant serves as a label. |
virtualDescendantId | int : The id of the virtual descendant. |
setLabelFor
Added in API level 17
public void setLabelFor (View labeled)
Sets the view for which the view represented by this info serves as a label for accessibility purposes.
Parameters | |
---|---|
labeled | View : The view for which this info serves as a label. |
setLabeledBy
Added in API level 17
public void setLabeledBy (View label)
Sets the view which serves as the label of the view represented by this info for accessibility purposes.
Parameters | |
---|---|
label | View : The view that labels this node's source. |
setLabeledBy
Added in API level 17
public void setLabeledBy (View root, int virtualDescendantId)
Sets the view which serves as the label of the view represented by this info for accessibility purposes. If virtualDescendantId
is
the root is set as the label.View#NO_ID
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
. This class is made immutable before being delivered to an AccessibilityService.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
. This class is made immutable before being delivered to an AccessibilityService.AccessibilityService
Parameters | |
---|---|
mode | int : The live region mode, or 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
. This class is made immutable before being delivered to an AccessibilityService.AccessibilityService
Parameters | |
---|---|
longClickable | boolean : True if the node is long clickable. |
Throws | |
---|---|
| 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
. This class is made immutable before being delivered to an AccessibilityService.AccessibilityService
Parameters | |
---|---|
max | int : The maximum text length. |
Throws | |
---|---|
| If called from an AccessibilityService. |
See also:
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
. This class is made immutable before being delivered to an AccessibilityService.AccessibilityService
Parameters | |
---|---|
granularities | int : The bit mask with granularities. |
Throws | |
---|---|
| 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
. This class is made immutable before being delivered to an AccessibilityService.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
. This class is made immutable before being delivered to an AccessibilityService.AccessibilityService
Parameters | |
---|---|
packageName | CharSequence : The package name. |
Throws | |
---|---|
| 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
. This class is made immutable before being delivered to an AccessibilityService.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
the root is set as the parent.View#NO_ID
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
. This class is made immutable before being delivered to an AccessibilityService.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
. This class is made immutable before being delivered to an AccessibilityService.AccessibilityService
Parameters | |
---|---|
parent | View : The parent. |
Throws | |
---|---|
| 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
. This class is made immutable before being delivered to an AccessibilityService.AccessibilityService
Parameters | |
---|---|
password | boolean : True if the node is a password. |
Throws | |
---|---|
| If called from an AccessibilityService. |
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
. This class is made immutable before being delivered to an AccessibilityService.AccessibilityService
Parameters | |
---|---|
rangeInfo | AccessibilityNodeInfo.RangeInfo : The range info. |
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
. This class is made immutable before being delivered to an AccessibilityService.AccessibilityService
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
. This class is made immutable before being delivered to an AccessibilityService.AccessibilityService
Parameters | |
---|---|
scrollable | boolean : True if the node is scrollable, false otherwise. |
Throws | |
---|---|
| 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
. This class is made immutable before being delivered to an AccessibilityService.AccessibilityService
Parameters | |
---|---|
selected | boolean : True if the node is selected. |
Throws | |
---|---|
| 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
. This class is made immutable before being delivered to an AccessibilityService.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
. This class is made immutable before being delivered to an AccessibilityService.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
the root is set as the source.View#NO_ID
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
. This class is made immutable before being delivered to an AccessibilityService.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
. This class is made immutable before being delivered to an AccessibilityService.AccessibilityService
Parameters | |
---|---|
stateDescription | CharSequence : the state description of this node. This value may be null . |
Throws | |
---|---|
| 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
. This class is made immutable before being delivered to an AccessibilityService.AccessibilityService
Parameters | |
---|---|
text | CharSequence : The text. |
Throws | |
---|---|
| 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
. This class is made immutable before being delivered to an AccessibilityService.AccessibilityService
Parameters | |
---|---|
isTextEntryKey | boolean : true if the node is a text entry key, false otherwise. |
setTextSelectable
public void setTextSelectable (boolean selectableText)
Sets if the node has selectable text.
Note: Cannot be called from an
. This class is made immutable before being delivered to an AccessibilityService.AccessibilityService
Parameters | |
---|---|
selectableText | boolean : True if the node has selectable text, false otherwise. |
Throws | |
---|---|
| 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
. This class is made immutable before being delivered to an AccessibilityService.AccessibilityService
Parameters | |
---|---|
start | int : The text selection start. |
end | int : The text selection end. |
Throws | |
---|---|
| 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
. This class is made immutable before being delivered to an AccessibilityService.AccessibilityService
Parameters | |
---|---|
tooltipText | CharSequence : The tooltip text. This value may be null . |
Throws | |
---|---|
| 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
. This class is made immutable before being delivered to an AccessibilityService.AccessibilityService
Parameters | |
---|---|
delegatedInfo | AccessibilityNodeInfo.TouchDelegateInfo : returned from . This value cannot be null . |
Throws | |
---|---|
| 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
. This class is made immutable before being delivered to an AccessibilityService.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
the root is set as the predecessor.View#NO_ID
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
. This class is made immutable before being delivered to an AccessibilityService.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
. This class is made immutable before being delivered to an AccessibilityService.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
the root is set as the successor.View#NO_ID
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
. This class is made immutable before being delivered to an AccessibilityService.AccessibilityService
Parameters | |
---|---|
root | View : The root of the virtual subtree. |
virtualDescendantId | int : The id of the virtual descendant. |
setUniqueId
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
. This class is made immutable before being delivered to an AccessibilityService.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
. This class is made immutable before being delivered to an AccessibilityService.AccessibilityService
Parameters | |
---|---|
visibleToUser | boolean : Whether the node is visible to the user. |
Throws | |
---|---|
| If called from an AccessibilityService. |
toString
Added in API level 14
public String toString ()
Returns a string representation of the object. In general, the toString
method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method.
The toString
method for class Object
returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@
', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of:
getClass().getName() + '@' + Integer.toHexString(hashCode())
Returns | |
---|---|
| 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 . Value is either 0 or a combination of , and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES |