java.lang.Object | |
↳ | android.view.accessibility.AccessibilityNodeInfo |
This class represents a node of the window content as well as actions that
can be requested from its source. From the point of view of an
AccessibilityService
a window content is
presented as tree of accessibility node info which may or may not map one-to-one
to the view hierarchy. In other words, a custom view is free to report itself as
a tree of accessibility node info.
Once an accessibility node info is delivered to an accessibility service it is made immutable and calling a state mutation method generates an error.
Please refer to AccessibilityService
for
details about how to obtain a handle to window content as a tree of accessibility
node info as well as familiarizing with the security model.
For more information about making applications accessible, read the Accessibility developer guide.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
AccessibilityNodeInfo.AccessibilityAction |
A class defining an action that can be performed on an AccessibilityNodeInfo .
|
||||||||||
AccessibilityNodeInfo.CollectionInfo | Class with information if a node is a collection. | ||||||||||
AccessibilityNodeInfo.CollectionItemInfo | Class with information if a node is a collection item. | ||||||||||
AccessibilityNodeInfo.RangeInfo | Class with information if a node is a range. |
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | ACTION_ACCESSIBILITY_FOCUS | Action that gives accessibility focus to the node. | |||||||||
String | ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN | Argument for whether when moving at granularity to extend the selection or to move it otherwise. | |||||||||
String | ACTION_ARGUMENT_HTML_ELEMENT_STRING | Argument for which HTML element to get moving to the next/previous HTML element. | |||||||||
String | ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT | Argument for which movement granularity to be used when traversing the node text. | |||||||||
String | ACTION_ARGUMENT_SELECTION_END_INT | Argument for specifying the selection end. | |||||||||
String | ACTION_ARGUMENT_SELECTION_START_INT | Argument for specifying the selection start. | |||||||||
String | ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE |
Argument for specifying the text content to set
Type: CharSequence |
|||||||||
int | ACTION_CLEAR_ACCESSIBILITY_FOCUS | Action that clears accessibility focus of the node. | |||||||||
int | ACTION_CLEAR_FOCUS | Action that clears input focus of the node. | |||||||||
int | ACTION_CLEAR_SELECTION | Action that deselects the node. | |||||||||
int | ACTION_CLICK | Action that clicks on the node info. | |||||||||
int | ACTION_COLLAPSE | Action to collapse an expandable node. | |||||||||
int | ACTION_COPY | Action to copy the current selection to the clipboard. | |||||||||
int | ACTION_CUT | Action to cut the current selection and place it to the clipboard. | |||||||||
int | ACTION_DISMISS | Action to dismiss a dismissable node. | |||||||||
int | ACTION_EXPAND | Action to expand an expandable node. | |||||||||
int | ACTION_FOCUS | Action that gives input focus to the node. | |||||||||
int | ACTION_LONG_CLICK | Action that long clicks on the node. | |||||||||
int | ACTION_NEXT_AT_MOVEMENT_GRANULARITY | Action that requests to go to the next entity in this node's text at a given movement granularity. | |||||||||
int | ACTION_NEXT_HTML_ELEMENT | Action to move to the next HTML element of a given type. | |||||||||
int | ACTION_PASTE | Action to paste the current clipboard content. | |||||||||
int | ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY | Action that requests to go to the previous entity in this node's text at a given movement granularity. | |||||||||
int | ACTION_PREVIOUS_HTML_ELEMENT | Action to move to the previous HTML element of a given type. | |||||||||
int | ACTION_SCROLL_BACKWARD | Action to scroll the node content backward. | |||||||||
int | ACTION_SCROLL_FORWARD | Action to scroll the node content forward. | |||||||||
int | ACTION_SELECT | Action that selects the node. | |||||||||
int | ACTION_SET_SELECTION | Action to set the selection. | |||||||||
int | ACTION_SET_TEXT | Action that sets the text of the node. | |||||||||
int | FOCUS_ACCESSIBILITY | The accessibility focus. | |||||||||
int | FOCUS_INPUT | The input focus. | |||||||||
int | MOVEMENT_GRANULARITY_CHARACTER | Movement granularity bit for traversing the text of a node by character. | |||||||||
int | MOVEMENT_GRANULARITY_LINE | Movement granularity bit for traversing the text of a node by line. | |||||||||
int | MOVEMENT_GRANULARITY_PAGE | Movement granularity bit for traversing the text of a node by page. | |||||||||
int | MOVEMENT_GRANULARITY_PARAGRAPH | Movement granularity bit for traversing the text of a node by paragraph. | |||||||||
int | MOVEMENT_GRANULARITY_WORD | Movement granularity bit for traversing the text of a node by word. |
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From interface
android.os.Parcelable
|
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
CREATOR |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Adds an action that can be performed on the node.
| |||||||||||
This method was deprecated
in API level 21.
This has been deprecated for
addAction(AccessibilityAction)
| |||||||||||
Adds a child.
| |||||||||||
Adds a virtual child which is a descendant of the given
root .
| |||||||||||
Gets if this node opens a popup or a dialog.
| |||||||||||
Describe the kinds of special objects contained in this Parcelable's
marshalled representation.
| |||||||||||
Compares this instance with the specified object and indicates if they
are equal.
| |||||||||||
Finds
AccessibilityNodeInfo s by text.
| |||||||||||
Finds
AccessibilityNodeInfo s by the fully qualified view id's resource
name where a fully qualified id is of the from "package:id/id_resource_name".
| |||||||||||
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.
| |||||||||||
This method was deprecated
in API level 21.
Use
getActionList() .
| |||||||||||
Gets the node bounds in parent coordinates.
| |||||||||||
Gets the node bounds in screen coordinates.
| |||||||||||
Get the child at given index.
| |||||||||||
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.
| |||||||||||
Gets the error text of this node.
| |||||||||||
Gets an optional bundle with extra data.
| |||||||||||
Gets the input type of the source as defined by
InputType .
| |||||||||||
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.
| |||||||||||
Gets the node's live region mode.
| |||||||||||
Returns the maximum text length for this node.
| |||||||||||
Gets the movement granularities for traversing the text of this node.
| |||||||||||
Gets the package this node comes from.
| |||||||||||
Gets the parent.
| |||||||||||
Gets the range info if this node is a range.
| |||||||||||
Gets the text of this node.
| |||||||||||
Gets the text selection end.
| |||||||||||
Gets the text selection start.
| |||||||||||
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 fully qualified resource name of the source view's id.
| |||||||||||
Gets the window to which this node belongs.
| |||||||||||
Gets the id of the window from which the info comes from.
| |||||||||||
Returns an integer hash code for this object.
| |||||||||||
Gets whether this node is accessibility focused.
| |||||||||||
Gets whether this node is checkable.
| |||||||||||
Gets whether this node is checked.
| |||||||||||
Gets whether this node is clickable.
| |||||||||||
Gets if the content of this node is invalid.
| |||||||||||
Gets if the node can be dismissed.
| |||||||||||
Gets if the node is editable.
| |||||||||||
Gets whether this node is enabled.
| |||||||||||
Gets whether this node is focusable.
| |||||||||||
Gets whether this node is focused.
| |||||||||||
Gets whether this node is long clickable.
| |||||||||||
Gets if the node is a multi line editable text.
| |||||||||||
Gets whether this node is a password.
| |||||||||||
Gets if the node is scrollable.
| |||||||||||
Gets whether this node is selected.
| |||||||||||
Sets whether this node is visible to the user.
| |||||||||||
Returns a cached instance if such is available otherwise a new one
and sets the source.
| |||||||||||
Returns a cached instance if such is available otherwise a new one.
| |||||||||||
Returns a cached instance if such is available otherwise a new one
and sets the source.
| |||||||||||
Returns a cached instance if such is available or a new one is
create.
| |||||||||||
Performs an action on the node.
| |||||||||||
Performs an action on the node.
| |||||||||||
Return an instance back to be reused.
| |||||||||||
Refreshes this info with the latest state of the view it represents.
| |||||||||||
This method was deprecated
in API level 21.
Use
removeAction(AccessibilityAction)
| |||||||||||
Removes an action that can be performed on the node.
| |||||||||||
Removes a virtual child which is a descendant of the given
root .
| |||||||||||
Removes a child.
| |||||||||||
Sets whether this node is accessibility focused.
| |||||||||||
Sets the node bounds in parent coordinates.
| |||||||||||
Sets the node bounds in screen coordinates.
| |||||||||||
Sets if this node opens a popup or a dialog.
| |||||||||||
Sets whether this node is checkable.
| |||||||||||
Sets whether this node is checked.
| |||||||||||
Sets the class this node comes from.
| |||||||||||
Sets whether this node is clickable.
| |||||||||||
Sets the collection info if the node is a collection.
| |||||||||||
Sets the collection item info if the node is a collection item.
| |||||||||||
Sets the content description of this node.
| |||||||||||
Sets if the content of this node is invalid.
| |||||||||||
Sets if the node can be dismissed.
| |||||||||||
Sets whether this node is editable.
| |||||||||||
Sets whether this node is enabled.
| |||||||||||
Sets the error text of this node.
| |||||||||||
Sets whether this node is focusable.
| |||||||||||
Sets whether this node is focused.
| |||||||||||
Sets the input type of the source as defined by
InputType .
| |||||||||||
Sets the view for which the view represented by this info serves as a
label for accessibility purposes.
| |||||||||||
Sets the view for which the view represented by this info serves as a
label for accessibility purposes.
| |||||||||||
Sets the view which serves as the label of the view represented by
this info for accessibility purposes.
| |||||||||||
Sets the view which serves as the label of the view represented by
this info for accessibility purposes.
| |||||||||||
Sets the node's live region mode.
| |||||||||||
Sets whether this node is long clickable.
| |||||||||||
Sets the maximum text length, or -1 for no limit.
| |||||||||||
Sets the movement granularities for traversing the text of this node.
| |||||||||||
Sets if the node is a multi line editable text.
| |||||||||||
Sets the package this node comes from.
| |||||||||||
Sets the parent.
| |||||||||||
Sets the parent to be a virtual descendant of the given
root .
| |||||||||||
Sets whether this node is a password.
| |||||||||||
Sets the range info if this node is a range.
| |||||||||||
Sets if the node is scrollable.
| |||||||||||
Sets whether this node is selected.
| |||||||||||
Sets the source.
| |||||||||||
Sets the source to be a virtual descendant of the given
root .
| |||||||||||
Sets the text of this node.
| |||||||||||
Sets the text selection start and end.
| |||||||||||
Sets the view whose node is visited after this one in accessibility traversal.
| |||||||||||
Sets the node after which this one is visited in accessibility traversal.
| |||||||||||
Sets the view before whose node this one should be visited during traversal.
| |||||||||||
Sets the node before which this one is visited during traversal.
| |||||||||||
Sets the fully qualified resource name of the source view's id.
| |||||||||||
Sets whether this node is visible to the user.
| |||||||||||
Returns a string containing a concise, human-readable description of this
object.
| |||||||||||
Flatten this object in to a Parcel.
Note: After the instance is written to a parcel it is recycled. |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
From interface
android.os.Parcelable
|
Action that gives accessibility focus to the node.
Argument for whether when moving at granularity to extend the selection or to move it otherwise.
Type: boolean
Actions: ACTION_NEXT_AT_MOVEMENT_GRANULARITY
,
ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY
Argument for which HTML element to get moving to the next/previous HTML element.
Type: String
Actions: ACTION_NEXT_HTML_ELEMENT
,
ACTION_PREVIOUS_HTML_ELEMENT
Argument for which movement granularity to be used when traversing the node text.
Type: int
Actions: ACTION_NEXT_AT_MOVEMENT_GRANULARITY
,
ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY
Argument for specifying the selection end.
Type: int
Actions: ACTION_SET_SELECTION
Argument for specifying the selection start.
Type: int
Actions: ACTION_SET_SELECTION
Argument for specifying the text content to set
Type: CharSequence
Actions: ACTION_SET_TEXT
Action that clears accessibility focus of the node.
Action that clears input focus of the node.
Action that deselects the node.
Action that clicks on the node info.
Action to collapse an expandable node.
Action to copy the current selection to the clipboard.
Action to cut the current selection and place it to the clipboard.
Action to dismiss a dismissable node.
Action to expand an expandable node.
Action that gives input focus to the node.
Action that long clicks on the node.
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:
Bundle arguments = new Bundle();
arguments.putInt(AccessibilityNodeInfo.ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT,
AccessibilityNodeInfo.MOVEMENT_GRANULARITY_CHARACTER);
arguments.putBoolean(AccessibilityNodeInfo.ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN,
false);
info.performAction(AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY, arguments);
ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT
<,
ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN
Example: Move to the previous character and do not extend selection.
Action to move to the next HTML element of a given type. For example, move to the BUTTON, INPUT, TABLE, etc.
Arguments:
Bundle arguments = new Bundle();
arguments.putString(AccessibilityNodeInfo.ACTION_ARGUMENT_HTML_ELEMENT_STRING, "BUTTON");
info.performAction(AccessibilityNodeInfo.ACTION_NEXT_HTML_ELEMENT, arguments);
ACTION_ARGUMENT_HTML_ELEMENT_STRING
Example:
Action to paste the current clipboard content.
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:
Bundle arguments = new Bundle();
arguments.putInt(AccessibilityNodeInfo.ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT,
AccessibilityNodeInfo.MOVEMENT_GRANULARITY_CHARACTER);
arguments.putBoolean(AccessibilityNodeInfo.ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN,
false);
info.performAction(AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY,
arguments);
ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT
<,
ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN
Example: Move to the next character and do not extend selection.
Action to move to the previous HTML element of a given type. For example, move to the BUTTON, INPUT, TABLE, etc.
Arguments:
Bundle arguments = new Bundle();
arguments.putString(AccessibilityNodeInfo.ACTION_ARGUMENT_HTML_ELEMENT_STRING, "BUTTON");
info.performAction(AccessibilityNodeInfo.ACTION_PREVIOUS_HTML_ELEMENT, arguments);
ACTION_ARGUMENT_HTML_ELEMENT_STRING
Example:
Action to scroll the node content backward.
Action to scroll the node content forward.
Action that selects the node.
Action to set the selection. Performing this action with no arguments clears the selection.
Arguments:
Bundle arguments = new Bundle();
arguments.putInt(AccessibilityNodeInfo.ACTION_ARGUMENT_SELECTION_START_INT, 1);
arguments.putInt(AccessibilityNodeInfo.ACTION_ARGUMENT_SELECTION_END_INT, 2);
info.performAction(AccessibilityNodeInfo.ACTION_SET_SELECTION, arguments);
ACTION_ARGUMENT_SELECTION_START_INT
,
ACTION_ARGUMENT_SELECTION_END_INT
Example:
Action that sets the text of the node. Performing the action without argument, using
null
or empty CharSequence
will clear the text. This action will also put the
cursor at the end of text.
Arguments:
Bundle arguments = new Bundle();
arguments.putCharSequence(AccessibilityNodeInfo.ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE,
"android");
info.performAction(AccessibilityNodeInfo.ACTION_SET_TEXT, arguments);
ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE
Example:
The accessibility focus.
The input focus.
Movement granularity bit for traversing the text of a node by character.
Movement granularity bit for traversing the text of a node by line.
Movement granularity bit for traversing the text of a node by page.
Movement granularity bit for traversing the text of a node by paragraph.
Movement granularity bit for traversing the text of a node by word.
Adds an action that can be performed on the node.
To add a standard action use the static constants on AccessibilityNodeInfo.AccessibilityAction
.
To add a custom action create a new AccessibilityNodeInfo.AccessibilityAction
by passing in a
resource id from your application as the action id and an optional label that
describes the action. To override one of the standard actions use as the action
id of a standard action id such as ACTION_CLICK
and an optional label that
describes the action.
Note: Cannot be called from an
AccessibilityService
.
This class is made immutable before being delivered to an AccessibilityService.
action | The action. |
---|
IllegalStateException | If called from an AccessibilityService. |
---|
This method was deprecated
in API level 21.
This has been deprecated for addAction(AccessibilityAction)
Adds an action that can be performed on the node.
Note: Cannot be called from an
AccessibilityService
.
This class is made immutable before being delivered to an AccessibilityService.
action | The action. |
---|
IllegalStateException | If called from an AccessibilityService. |
---|---|
IllegalArgumentException | If the argument is not one of the standard actions. |
Adds a child.
Note: Cannot be called from an
AccessibilityService
.
This class is made immutable before being delivered to an AccessibilityService.
child | The child. |
---|
IllegalStateException | If called from an AccessibilityService. |
---|
Adds a virtual child which is a descendant of the given root
.
If virtualDescendantId
is NO_ID
the root
is added as a child.
A virtual descendant is an imaginary View that is reported as a part of the view hierarchy for accessibility purposes. This enables custom views that draw complex content to report them selves as a tree of virtual views, thus conveying their logical structure.
root | The root of the virtual subtree. |
---|---|
virtualDescendantId | The id of the virtual child. |
Gets if this node opens a popup or a dialog.
Describe the kinds of special objects contained in this Parcelable's marshalled representation.
Compares this instance with the specified object and indicates if they
are equal. In order to be equal, o
must represent the same object
as this instance using a class-specific comparison. The general contract
is that this comparison should be reflexive, symmetric, and transitive.
Also, no object reference other than null is equal to null.
The default implementation returns true
only if this ==
o
. See Writing a correct
equals
method
if you intend implementing your own equals
method.
The general contract for the equals
and hashCode()
methods is that if equals
returns true
for
any two objects, then hashCode()
must return the same value for
these objects. This means that subclasses of Object
usually
override either both methods or neither of them.
object | the object to compare this instance with. |
---|
true
if the specified object is equal to this Object
; false
otherwise.Finds AccessibilityNodeInfo
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.
Note: It is a client responsibility to recycle the
received info by calling recycle()
to avoid creating of multiple instances.
text | The searched text. |
---|
Finds AccessibilityNodeInfo
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".
Note: It is a client responsibility to recycle the
received info by calling recycle()
to avoid creating of multiple instances.
Note: The primary usage of this API is for UI test automation
and in order to report the fully qualified view id if an AccessibilityNodeInfo
the client has to set the FLAG_REPORT_VIEW_IDS
flag when configuring his AccessibilityService
.
viewId | The fully qualified resource name of the view id to find. |
---|
Find the view that has the specified focus type. The search starts from the view represented by this node info.
focus | The focus to find. One of FOCUS_INPUT or
FOCUS_ACCESSIBILITY . |
---|
Searches for the nearest view in the specified direction that can take the input focus.
direction | The direction. Can be one of:
FOCUS_DOWN ,
FOCUS_UP ,
FOCUS_LEFT ,
FOCUS_RIGHT ,
FOCUS_FORWARD ,
FOCUS_BACKWARD . |
---|
Gets the actions that can be performed on the node.
This method was deprecated
in API level 21.
Use getActionList()
.
Gets the actions that can be performed on the node.
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
Gets the node bounds in parent coordinates.
outBounds | The output node bounds. |
---|
Gets the node bounds in screen coordinates.
outBounds | The output node bounds. |
---|
Get the child at given index.
Note: It is a client responsibility to recycle the
received info by calling recycle()
to avoid creating of multiple instances.
index | The child index. |
---|
IllegalStateException | If called outside of an AccessibilityService. |
---|
Gets the number of children.
Gets the class this node comes from.
Gets the collection info if the node is a collection. A collection child is always a collection item.
Gets the collection item info if the node is a collection item. A collection item is always a child of a collection.
Gets the content description of this node.
Gets the error text of this node.
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.
Gets the input type of the source as defined by InputType
.
Gets the node info for which the view represented by this info serves as a label for accessibility purposes.
Note: It is a client responsibility to recycle the
received info by calling recycle()
to avoid creating of multiple instances.
Gets the node info which serves as the label of the view represented by this info for accessibility purposes.
Note: It is a client responsibility to recycle the
received info by calling recycle()
to avoid creating of multiple instances.
Gets the node's live region mode.
A live region is a node that contains information that is important for
the user and when it changes the user should be notified. For example,
in a login screen with a TextView that displays an "incorrect password"
notification, that view should be marked as a live region with mode
ACCESSIBILITY_LIVE_REGION_POLITE
.
It is the responsibility of the accessibility service to monitor
TYPE_WINDOW_CONTENT_CHANGED
events indicating
changes to live region nodes and their children.
ACCESSIBILITY_LIVE_REGION_NONE
if the view is not a
live region.Returns the maximum text length for this node.
Gets the movement granularities for traversing the text of this node.
Gets the package this node comes from.
Gets the parent.
Note: It is a client responsibility to recycle the
received info by calling recycle()
to avoid creating of multiple instances.
Gets the range info if this node is a range.
Gets the text selection end.
Gets the text selection start.
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.
null
.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.
null
.Gets the fully qualified resource name of the source view's id.
Note: The primary usage of this API is for UI test automation
and in order to report the source view id of an AccessibilityNodeInfo
the
client has to set the FLAG_REPORT_VIEW_IDS
flag when configuring his AccessibilityService
.
Gets the id of the window from which the info comes from.
Returns an integer hash code for this object. By contract, any two
objects for which equals(Object)
returns true
must return
the same hash code value. This means that subclasses of Object
usually override both methods or neither method.
Note that hash values must not change over time unless information used in equals comparisons also changes.
See Writing a correct
hashCode
method
if you intend implementing your own hashCode
method.
Gets whether this node is accessibility focused.
Gets whether this node is checkable.
Gets whether this node is checked.
Gets whether this node is clickable.
Gets if the content of this node is invalid. For example, a date is not well-formed.
Gets if the node can be dismissed.
Gets if the node is editable.
Gets whether this node is enabled.
Gets whether this node is focusable.
Gets whether this node is focused.
Gets whether this node is long clickable.
Gets if the node is a multi line editable text.
Gets whether this node is a password.
Gets if the node is scrollable.
Gets whether this node is selected.
Sets whether this node is visible to the user.
Returns a cached instance if such is available otherwise a new one and sets the source.
root | The root of the virtual subtree. |
---|---|
virtualDescendantId | The id of the virtual descendant. |
Returns a cached instance if such is available otherwise a new one.
Returns a cached instance if such is available otherwise a new one and sets the source.
source | The source view. |
---|
Returns a cached instance if such is available or a new one is
create. The returned instance is initialized from the given
info
.
info | The other info. |
---|
Performs an action on the node.
Note: An action can be performed only if the request is made
from an AccessibilityService
.
action | The action to perform. |
---|
IllegalStateException | If called outside of an AccessibilityService. |
---|
Performs an action on the node.
Note: An action can be performed only if the request is made
from an AccessibilityService
.
action | The action to perform. |
---|---|
arguments | A bundle with additional arguments. |
IllegalStateException | If called outside of an AccessibilityService. |
---|
Return an instance back to be reused.
Note: You must not touch the object after calling this function.
IllegalStateException | If the info is already recycled. |
---|
Refreshes this info with the latest state of the view it represents.
Note: If this method returns false this info is obsolete since it represents a view that is no longer in the view tree and should be recycled.
This method was deprecated
in API level 21.
Use removeAction(AccessibilityAction)
Removes an action that can be performed on the node. If the action was not already added to the node, calling this method has no effect.
Note: Cannot be called from an
AccessibilityService
.
This class is made immutable before being delivered to an AccessibilityService.
action | The action to be removed. |
---|
IllegalStateException | If called from an AccessibilityService. |
---|
Removes an action that can be performed on the node. If the action was not already added to the node, calling this method has no effect.
Note: Cannot be called from an
AccessibilityService
.
This class is made immutable before being delivered to an AccessibilityService.
action | The action to be removed. |
---|
IllegalStateException | If called from an AccessibilityService. |
---|
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.
root | The root of the virtual subtree. |
---|---|
virtualDescendantId | The id of the virtual child. |
Removes a child. If the child was not previously added to the node, calling this method has no effect.
Note: Cannot be called from an
AccessibilityService
.
This class is made immutable before being delivered to an AccessibilityService.
child | The child. |
---|
IllegalStateException | If called from an AccessibilityService. |
---|
Sets whether this node is accessibility focused.
Note: Cannot be called from an
AccessibilityService
.
This class is made immutable before being delivered to an AccessibilityService.
focused | True if the node is accessibility focused. |
---|
IllegalStateException | If called from an AccessibilityService. |
---|
Sets the node bounds in parent coordinates.
Note: Cannot be called from an
AccessibilityService
.
This class is made immutable before being delivered to an AccessibilityService.
bounds | The node bounds. |
---|
IllegalStateException | If called from an AccessibilityService. |
---|
Sets the node bounds in screen coordinates.
Note: Cannot be called from an
AccessibilityService
.
This class is made immutable before being delivered to an AccessibilityService.
bounds | The node bounds. |
---|
IllegalStateException | If called from an AccessibilityService. |
---|
Sets if this node opens a popup or a dialog.
Note: Cannot be called from an
AccessibilityService
.
This class is made immutable before being delivered to an AccessibilityService.
opensPopup | If the the node opens a popup. |
---|
Sets whether this node is checkable.
Note: Cannot be called from an
AccessibilityService
.
This class is made immutable before being delivered to an AccessibilityService.
checkable | True if the node is checkable. |
---|
IllegalStateException | If called from an AccessibilityService. |
---|
Sets whether this node is checked.
Note: Cannot be called from an
AccessibilityService
.
This class is made immutable before being delivered to an AccessibilityService.
checked | True if the node is checked. |
---|
IllegalStateException | If called from an AccessibilityService. |
---|
Sets the class this node comes from.
Note: Cannot be called from an
AccessibilityService
.
This class is made immutable before being delivered to an AccessibilityService.
className | The class name. |
---|
IllegalStateException | If called from an AccessibilityService. |
---|
Sets whether this node is clickable.
Note: Cannot be called from an
AccessibilityService
.
This class is made immutable before being delivered to an AccessibilityService.
clickable | True if the node is clickable. |
---|
IllegalStateException | If called from an AccessibilityService. |
---|
Sets the collection info if the node is a collection. A collection child is always a collection item.
Note: Cannot be called from an
AccessibilityService
.
This class is made immutable before being delivered to an AccessibilityService.
collectionInfo | The collection info. |
---|
Sets the collection item info if the node is a collection item. A collection item is always a child of a collection.
Note: Cannot be called from an
AccessibilityService
.
This class is made immutable before being delivered to an AccessibilityService.
Sets the content description of this node.
Note: Cannot be called from an
AccessibilityService
.
This class is made immutable before being delivered to an AccessibilityService.
contentDescription | The content description. |
---|
IllegalStateException | If called from an AccessibilityService. |
---|
Sets if the content of this node is invalid. For example, a date is not well-formed.
Note: Cannot be called from an
AccessibilityService
.
This class is made immutable before being delivered to an AccessibilityService.
contentInvalid | If the node content is invalid. |
---|
Sets if the node can be dismissed.
Note: Cannot be called from an
AccessibilityService
.
This class is made immutable before being delivered to an AccessibilityService.
dismissable | If the node can be dismissed. |
---|
Sets whether this node is editable.
Note: Cannot be called from an
AccessibilityService
.
This class is made immutable before being delivered to an AccessibilityService.
editable | True if the node is editable. |
---|
IllegalStateException | If called from an AccessibilityService. |
---|
Sets whether this node is enabled.
Note: Cannot be called from an
AccessibilityService
.
This class is made immutable before being delivered to an AccessibilityService.
enabled | True if the node is enabled. |
---|
IllegalStateException | If called from an AccessibilityService. |
---|
Sets the error text of this node.
Note: Cannot be called from an
AccessibilityService
.
This class is made immutable before being delivered to an AccessibilityService.
error | The error text. |
---|
IllegalStateException | If called from an AccessibilityService. |
---|
Sets whether this node is focusable.
Note: Cannot be called from an
AccessibilityService
.
This class is made immutable before being delivered to an AccessibilityService.
focusable | True if the node is focusable. |
---|
IllegalStateException | If called from an AccessibilityService. |
---|
Sets whether this node is focused.
Note: Cannot be called from an
AccessibilityService
.
This class is made immutable before being delivered to an AccessibilityService.
focused | True if the node is focused. |
---|
IllegalStateException | If called from an AccessibilityService. |
---|
Sets the input type of the source as defined by InputType
.
Note: Cannot be called from an
AccessibilityService
.
This class is made immutable before being delivered to an
AccessibilityService.
inputType | The input type. |
---|
IllegalStateException | If called from an AccessibilityService. |
---|
Sets the view for which the view represented by this info serves as a label for accessibility purposes.
labeled | The view for which this info serves as a label. |
---|
Sets the view for which the view represented by this info serves as a
label for accessibility purposes. If virtualDescendantId
is NO_ID
the root is set as the labeled.
A virtual descendant is an imaginary View that is reported as a part of the view hierarchy for accessibility purposes. This enables custom views that draw complex content to report themselves as a tree of virtual views, thus conveying their logical structure.
Note: Cannot be called from an
AccessibilityService
.
This class is made immutable before being delivered to an AccessibilityService.
root | The root whose virtual descendant serves as a label. |
---|---|
virtualDescendantId | The id of the virtual descendant. |
Sets the view which serves as the label of the view represented by this info for accessibility purposes.
label | The view that labels this node's source. |
---|
Sets the view which serves as the label of the view represented by
this info for accessibility purposes. If virtualDescendantId
is NO_ID
the root is set as the label.
A virtual descendant is an imaginary View that is reported as a part of the view hierarchy for accessibility purposes. This enables custom views that draw complex content to report themselves as a tree of virtual views, thus conveying their logical structure.
Note: Cannot be called from an
AccessibilityService
.
This class is made immutable before being delivered to an AccessibilityService.
root | The root whose virtual descendant labels this node's source. |
---|---|
virtualDescendantId | The id of the virtual descendant. |
Sets the node's live region mode.
Note: Cannot be called from an
AccessibilityService
. This class is
made immutable before being delivered to an AccessibilityService.
mode | The live region mode, or
ACCESSIBILITY_LIVE_REGION_NONE if the view is not a
live region. |
---|
Sets whether this node is long clickable.
Note: Cannot be called from an
AccessibilityService
.
This class is made immutable before being delivered to an AccessibilityService.
longClickable | True if the node is long clickable. |
---|
IllegalStateException | If called from an AccessibilityService. |
---|
Sets the maximum text length, or -1 for no limit.
Typically used to indicate that an editable text field has a limit on the number of characters entered.
Note: Cannot be called from an
AccessibilityService
.
This class is made immutable before being delivered to an AccessibilityService.
max | The maximum text length. |
---|
IllegalStateException | If called from an AccessibilityService. |
---|
Sets the movement granularities for traversing the text of this node.
Note: Cannot be called from an
AccessibilityService
.
This class is made immutable before being delivered to an AccessibilityService.
granularities | The bit mask with granularities. |
---|
IllegalStateException | If called from an AccessibilityService. |
---|
Sets if the node is a multi line editable text.
Note: Cannot be called from an
AccessibilityService
.
This class is made immutable before being delivered to an AccessibilityService.
multiLine | True if the node is multi line. |
---|
Sets the package this node comes from.
Note: Cannot be called from an
AccessibilityService
.
This class is made immutable before being delivered to an AccessibilityService.
packageName | The package name. |
---|
IllegalStateException | If called from an AccessibilityService. |
---|
Sets the parent.
Note: Cannot be called from an
AccessibilityService
.
This class is made immutable before being delivered to an AccessibilityService.
parent | The parent. |
---|
IllegalStateException | If called from an AccessibilityService. |
---|
Sets the parent to be a virtual descendant of the given root
.
If virtualDescendantId
equals to NO_ID
the root
is set as the parent.
A virtual descendant is an imaginary View that is reported as a part of the view hierarchy for accessibility purposes. This enables custom views that draw complex content to report them selves as a tree of virtual views, thus conveying their logical structure.
Note: Cannot be called from an
AccessibilityService
.
This class is made immutable before being delivered to an AccessibilityService.
root | The root of the virtual subtree. |
---|---|
virtualDescendantId | The id of the virtual descendant. |
Sets whether this node is a password.
Note: Cannot be called from an
AccessibilityService
.
This class is made immutable before being delivered to an AccessibilityService.
password | True if the node is a password. |
---|
IllegalStateException | If called from an AccessibilityService. |
---|
Sets the range info if this node is a range.
Note: Cannot be called from an
AccessibilityService
.
This class is made immutable before being delivered to an AccessibilityService.
rangeInfo | The range info. |
---|
Sets if the node is scrollable.
Note: Cannot be called from an
AccessibilityService
.
This class is made immutable before being delivered to an AccessibilityService.
scrollable | True if the node is scrollable, false otherwise. |
---|
IllegalStateException | If called from an AccessibilityService. |
---|
Sets whether this node is selected.
Note: Cannot be called from an
AccessibilityService
.
This class is made immutable before being delivered to an AccessibilityService.
selected | True if the node is selected. |
---|
IllegalStateException | If called from an AccessibilityService. |
---|
Sets the source.
Note: Cannot be called from an
AccessibilityService
.
This class is made immutable before being delivered to an AccessibilityService.
source | The info source. |
---|
Sets the source to be a virtual descendant of the given root
.
If virtualDescendantId
is NO_ID
the root
is set as the source.
A virtual descendant is an imaginary View that is reported as a part of the view hierarchy for accessibility purposes. This enables custom views that draw complex content to report themselves as a tree of virtual views, thus conveying their logical structure.
Note: Cannot be called from an
AccessibilityService
.
This class is made immutable before being delivered to an AccessibilityService.
root | The root of the virtual subtree. |
---|---|
virtualDescendantId | The id of the virtual descendant. |
Sets the text of this node.
Note: Cannot be called from an
AccessibilityService
.
This class is made immutable before being delivered to an AccessibilityService.
text | The text. |
---|
IllegalStateException | If called from an AccessibilityService. |
---|
Sets the text selection start and end.
Note: Cannot be called from an
AccessibilityService
.
This class is made immutable before being delivered to an AccessibilityService.
start | The text selection start. |
---|---|
end | The text selection end. |
IllegalStateException | If called from an AccessibilityService. |
---|
Sets the view whose node is visited after this one in accessibility traversal. A screen-reader must visit the content of the other node before the content of this one.
Note: Cannot be called from an
AccessibilityService
.
This class is made immutable before being delivered to an AccessibilityService.
view | The previous view. |
---|
Sets the node after which this one is visited in accessibility traversal.
A screen-reader must visit the content of the other node before the content
of this one. If virtualDescendantId
equals to NO_ID
the root is set as the predecessor.
A virtual descendant is an imaginary View that is reported as a part of the view hierarchy for accessibility purposes. This enables custom views that draw complex content to report them selves as a tree of virtual views, thus conveying their logical structure.
Note: Cannot be called from an
AccessibilityService
.
This class is made immutable before being delivered to an AccessibilityService.
root | The root of the virtual subtree. |
---|---|
virtualDescendantId | The id of the virtual descendant. |
Sets the view before whose node this one should be visited during traversal. A screen-reader must visit the content of this node before the content of the one it precedes.
Note: Cannot be called from an
AccessibilityService
.
This class is made immutable before being delivered to an AccessibilityService.
view | The view providing the preceding node. |
---|
Sets the node before which this one is visited during traversal. A screen-reader
must visit the content of this node before the content of the one it precedes.
The successor is a virtual descendant of the given root
. If
virtualDescendantId
equals to NO_ID
the root is set
as the successor.
A virtual descendant is an imaginary View that is reported as a part of the view hierarchy for accessibility purposes. This enables custom views that draw complex content to report them selves as a tree of virtual views, thus conveying their logical structure.
Note: Cannot be called from an
AccessibilityService
.
This class is made immutable before being delivered to an AccessibilityService.
root | The root of the virtual subtree. |
---|---|
virtualDescendantId | The id of the virtual descendant. |
Sets the fully qualified resource name of the source view's id.
Note: Cannot be called from an
AccessibilityService
.
This class is made immutable before being delivered to an AccessibilityService.
viewIdResName | The id resource name. |
---|
Sets whether this node is visible to the user.
Note: Cannot be called from an
AccessibilityService
.
This class is made immutable before being delivered to an AccessibilityService.
visibleToUser | Whether the node is visible to the user. |
---|
IllegalStateException | If called from an AccessibilityService. |
---|
Returns a string containing a concise, human-readable description of this object. Subclasses are encouraged to override this method and provide an implementation that takes into account the object's type and data. The default implementation is equivalent to the following expression:
getClass().getName() + '@' + Integer.toHexString(hashCode())
See Writing a useful
toString
method
if you intend implementing your own toString
method.
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.
parcel | The Parcel in which the object should be written. |
---|---|
flags | Additional flags about how the object should be written.
May be 0 or PARCELABLE_WRITE_RETURN_VALUE .
|