AccessibilityNodeInfo
open class AccessibilityNodeInfo : Parcelable
kotlin.Any | |
↳ | 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 android.accessibilityservice.AccessibilityService
a window's content is presented as a tree of accessibility node infos, which may or may not map one-to-one to the view hierarchy. In other words, a custom view is free to report itself as a tree of accessibility node info.
Once an accessibility node info is delivered to an accessibility service it is made immutable and calling a state mutation method generates an error. See setQueryFromAppProcessEnabled
if you would like to inspect the node tree from the app process for testing or debugging tools.
Please refer to android.accessibilityservice.AccessibilityService
for details about how to obtain a handle to window content as a tree of accessibility node info as well as details about the security model.
Summary
Nested classes | |
---|---|
A class defining an action that can be performed on an |
|
Class with information if a node is a collection. |
|
Class with information if a node is a collection item. |
|
Class with information of a view useful to evaluate accessibility needs. |
|
Class with information if a node is a range. |
|
Class with information of touch delegated views and regions from |
Constants | |
---|---|
static Int |
Action that gives accessibility focus to the node. |
static String |
Argument for specifying the collection column to make visible on screen. |
static String |
Argument to represent the direction when using |
static String |
Argument for whether when moving at granularity to extend the selection or to move it otherwise. |
static String |
Argument for which HTML element to get moving to the next/previous HTML element. |
static String |
Argument for which movement granularity to be used when traversing the node text. |
static String |
Argument for specifying the x coordinate to which to move a window. |
static String |
Argument for specifying the y coordinate to which to move a window. |
static String |
Argument to represent the duration in milliseconds to press and hold a node. |
static String |
Argument for specifying the progress value to set. |
static String |
Argument for specifying the collection row to make visible on screen. |
static String |
Argument to represent the scroll amount as a percent of the visible area of a node, with 1. |
static String |
Argument for specifying the selection end. |
static String |
Argument for specifying the selection start. |
static String |
Argument for specifying the text content to set. |
static Int |
Action that clears accessibility focus of the node. |
static Int |
Action that clears input focus of the node. |
static Int |
Action that deselects the node. |
static Int |
Action that clicks on the node info. |
static Int |
Action to collapse an expandable node. |
static Int |
Action to copy the current selection to the clipboard. |
static Int |
Action to cut the current selection and place it to the clipboard. |
static Int |
Action to dismiss a dismissable node. |
static Int |
Action to expand an expandable node. |
static Int |
Action that gives input focus to the node. |
static Int |
Action that long clicks on the node. |
static Int |
Action that requests to go to the next entity in this node's text at a given movement granularity. |
static Int |
Action to move to the next HTML element of a given type. |
static Int |
Action to paste the current clipboard content. |
static Int |
Action that requests to go to the previous entity in this node's text at a given movement granularity. |
static Int |
Action to move to the previous HTML element of a given type. |
static Int |
Action to scroll the node content backward. |
static Int |
Action to scroll the node content forward. |
static Int |
Action that selects the node. |
static Int |
Action to set the selection. |
static Int |
Action that sets the text of the node. |
static Int |
This node is not checked. |
static Int |
This node is partially checked. |
static Int |
This node is checked. |
static Int |
Expanded state for a collapsed expandable element. |
static Int |
Expanded state for a expanded expandable element that cannot be expanded further. |
static Int |
Expanded state for an expanded expandable element that can still be expanded further. |
static Int |
Expanded state for a non-expandable element |
static String |
Key used to request extra data for the rendering information. |
static String |
Integer argument specifying the end index of the requested text location data. |
static Int |
The maximum allowed length of the requested text location data. |
static String |
Integer argument specifying the start index of the requested text location data. |
static String |
Key used to request and locate extra data for text character location. |
static Int |
Prefetching strategy that prefetches the ancestors of the requested node. |
static Int |
Prefetching strategy that prefetches the descendants of the requested node breadth-first. |
static Int |
Prefetching strategy that prefetches the descendants of the requested node depth-first. |
static Int |
Prefetching strategy that prefetches the descendants in a hybrid depth first and breadth first approach. |
static Int |
Prefetching strategy that prefetches the siblings of the requested node. |
static Int |
Prefetching flag that specifies prefetching should not be interrupted by a request to retrieve a node or perform an action on a node. |
static Int |
The accessibility focus. |
static Int |
The input focus. |
static Int |
Maximum batch size of prefetched nodes for a request. |
static Int |
Movement granularity bit for traversing the text of a node by character. |
static Int |
Movement granularity bit for traversing the text of a node by line. |
static Int |
Movement granularity bit for traversing the text of a node by page. |
static Int |
Movement granularity bit for traversing the text of a node by paragraph. |
static Int |
Movement granularity bit for traversing the text of a node by word. |
Inherited constants | |
---|---|
Public constructors | |
---|---|
Creates a new |
|
Copy constructor. |
|
AccessibilityNodeInfo(source: View) Creates a new |
|
AccessibilityNodeInfo(root: View, virtualDescendantId: Int) Creates a new |
Public methods | |
---|---|
open Unit |
Adds an action that can be performed on the node. |
open Unit |
Adds an action that can be performed on the node. |
open Unit |
Adds a child. |
open Unit |
Adds a virtual child which is a descendant of the given |
open Unit |
addLabeledBy(label: View) Adds the view which serves as the label of the view represented by this info for accessibility purposes. |
open Unit |
addLabeledBy(root: View, virtualDescendantId: Int) Adds the view which serves as the label of the view represented by this info for accessibility purposes. |
open Boolean |
Gets if this node opens a popup or a dialog. |
open Int |
Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. |
open Boolean |
Indicates whether some other object is "equal to" this one. |
open MutableList<AccessibilityNodeInfo!>! |
Finds |
open MutableList<AccessibilityNodeInfo!>! |
findAccessibilityNodeInfosByViewId(viewId: String) Finds |
open AccessibilityNodeInfo! |
Find the view that has the specified focus type. |
open AccessibilityNodeInfo! |
focusSearch(direction: Int) Searches for the nearest view in the specified direction that can take the input focus. |
open MutableList<AccessibilityNodeInfo.AccessibilityAction!>! |
Gets the actions that can be performed on the node. |
open Int |
Gets the actions that can be performed on the node. |
open MutableList<String!>! |
Get the extra data available for this node. |
open Unit |
getBoundsInParent(outBounds: Rect!) Gets the node bounds in the viewParent's coordinates. |
open Unit |
getBoundsInScreen(outBounds: Rect!) Gets the node bounds in screen coordinates. |
open Unit |
getBoundsInWindow(outBounds: Rect) Gets the node bounds in window coordinates. |
open Int |
Gets the checked state of this node. |
open AccessibilityNodeInfo! |
Get the child at given index. |
open AccessibilityNodeInfo? |
Get the child at given index. |
open Int |
Gets the number of children. |
open CharSequence! |
Gets the class this node comes from. |
open AccessibilityNodeInfo.CollectionInfo! |
Gets the collection info if the node is a collection. |
open AccessibilityNodeInfo.CollectionItemInfo! |
Gets the collection item info if the node is a collection item. |
open CharSequence? |
Returns the container title. |
open CharSequence! |
Gets the content description of this node. |
open Int |
Get the drawing order of the view corresponding it this node. |
open CharSequence! |
getError() Gets the error text of this node. |
open Int |
Gets the expanded state for this node. |
open AccessibilityNodeInfo.ExtraRenderingInfo? |
Gets the |
open Bundle! |
Gets an optional bundle with extra data. |
open CharSequence! |
Gets the hint text of this node. |
open Int |
Gets the input type of the source as defined by |
open AccessibilityNodeInfo! |
Gets the node info for which the view represented by this info serves as a label for accessibility purposes. |
open AccessibilityNodeInfo! |
Gets the node info which serves as the label of the view represented by this info for accessibility purposes. |
open MutableList<AccessibilityNodeInfo!> |
Gets the list of node infos which serve as the labels of the view represented by this info for accessibility purposes. |
open Int |
Gets the node's live region mode. |
open Int |
Returns the maximum text length for this node. |
open Duration |
Gets the minimum time duration between two content change events. |
open Int |
Gets the movement granularities for traversing the text of this node. |
open CharSequence! |
Gets the package this node comes from. |
open CharSequence? |
Get the title of the pane represented by this node. |
open AccessibilityNodeInfo! |
Gets the parent. |
open AccessibilityNodeInfo? |
Gets the parent. |
open AccessibilityNodeInfo.RangeInfo! |
Gets the range info if this node is a range. |
open CharSequence? |
Get the state description of this node. |
open CharSequence! |
getText() Gets the text of this node. |
open Int |
Gets the text selection end if text is selected. |
open Int |
Gets the text selection start or the cursor position. |
open CharSequence? |
Gets the tooltip text of this node. |
open AccessibilityNodeInfo.TouchDelegateInfo? |
Get the |
open AccessibilityNodeInfo! |
Gets the node after which this one is visited in accessibility traversal. |
open AccessibilityNodeInfo! |
Gets the node before which this one is visited during traversal. |
open String? |
Gets the unique id of the node. |
open String! |
Gets the fully qualified resource name of the source view's id. |
open AccessibilityWindowInfo! |
Gets the window to which this node belongs. |
open Int |
Gets the id of the window from which the info comes from. |
open Boolean |
Gets whether the node has |
open Int |
hashCode() |
open Boolean |
Gets if the node's accessibility data is considered sensitive. |
open Boolean |
Gets whether this node is accessibility focused. |
open Boolean |
Gets whether this node is checkable. |
open Boolean |
Gets whether this node is checked. |
open Boolean |
Gets whether this node is clickable. |
open Boolean |
Gets if the content of this node is invalid. |
open Boolean |
Gets whether this node is context clickable. |
open Boolean |
Gets if the node can be dismissed. |
open Boolean |
Gets if the node is editable. |
open Boolean |
Gets whether this node is enabled. |
open Boolean |
Gets whether this node is focusable. |
open Boolean |
Gets whether this node is focused. |
open Boolean |
Gets if the node supports granular scrolling. |
open Boolean |
Returns whether node represents a heading. |
open Boolean |
Returns whether the node originates from a view considered important for accessibility. |
open Boolean |
Gets whether this node is long clickable. |
open Boolean |
Gets if the node is a multi line editable text. |
open Boolean |
Gets whether this node is a password. |
open Boolean |
Returns whether the node is explicitly marked as a focusable unit by a screen reader. |
open Boolean |
Gets if the node is scrollable. |
open Boolean |
Gets whether this node is selected. |
open Boolean |
Returns whether the node's text represents a hint for the user to enter text. |
open Boolean |
Returns whether node represents a text entry key that is part of a keyboard or keypad. |
open Boolean |
Gets if the node has selectable text. |
open Boolean |
Gets whether this node is visible to the user. |
open static AccessibilityNodeInfo! |
obtain() Instantiates a new AccessibilityNodeInfo. |
open static AccessibilityNodeInfo! |
obtain(info: AccessibilityNodeInfo!) Instantiates a new AccessibilityNodeInfo initialized from the given |
open static AccessibilityNodeInfo! |
Returns a cached instance if such is available otherwise a new one and sets the source. |
open static AccessibilityNodeInfo! |
Returns a cached instance if such is available otherwise a new one and sets the source. |
open Boolean |
performAction(action: Int) Performs an action on the node. |
open Boolean |
performAction(action: Int, arguments: Bundle!) Performs an action on the node. |
open Unit |
recycle() Would previously return an instance back to be reused. |
open Boolean |
refresh() Refreshes this info with the latest state of the view it represents. |
open Boolean |
refreshWithExtraData(extraDataKey: String!, args: Bundle!) Refreshes this info with the latest state of the view it represents, and request new data be added by the View. |
open Boolean |
Removes an action that can be performed on the node. |
open Unit |
removeAction(action: Int) Removes an action that can be performed on the node. |
open Boolean |
removeChild(child: View!) Removes a child. |
open Boolean |
removeChild(root: View!, virtualDescendantId: Int) Removes a virtual child which is a descendant of the given |
open Boolean |
removeLabeledBy(label: View) Removes a label. |
open Boolean |
removeLabeledBy(root: View, virtualDescendantId: Int) Removes a label which is a virtual descendant of the given |
open Unit |
setAccessibilityDataSensitive(accessibilityDataSensitive: Boolean) Sets whether this node's accessibility data is considered sensitive. |
open Unit |
setAccessibilityFocused(focused: Boolean) Sets whether this node is accessibility focused. |
open Unit |
setAvailableExtraData(extraDataKeys: MutableList<String!>!) Set the extra data available for this node. |
open Unit |
setBoundsInParent(bounds: Rect!) Sets the node bounds in the viewParent's coordinates. |
open Unit |
setBoundsInScreen(bounds: Rect!) Sets the node bounds in screen coordinates. |
open Unit |
setBoundsInWindow(bounds: Rect) Sets the node bounds in window coordinates. |
open Unit |
setCanOpenPopup(opensPopup: Boolean) Sets if this node opens a popup or a dialog. |
open Unit |
setCheckable(checkable: Boolean) Sets whether this node is checkable. |
open Unit |
setChecked(checked: Boolean) Sets whether this node is checked. |
open Unit |
setChecked(checked: Int) Sets the checked state of this node. |
open Unit |
setClassName(className: CharSequence!) Sets the class this node comes from. |
open Unit |
setClickable(clickable: Boolean) Sets whether this node is clickable. |
open Unit |
setCollectionInfo(collectionInfo: AccessibilityNodeInfo.CollectionInfo!) Sets the collection info if the node is a collection. |
open Unit |
setCollectionItemInfo(collectionItemInfo: AccessibilityNodeInfo.CollectionItemInfo!) Sets the collection item info if the node is a collection item. |
open Unit |
setContainerTitle(containerTitle: CharSequence?) Sets the container title for app-developer-defined container which can be any type of ViewGroup or layout. |
open Unit |
setContentDescription(contentDescription: CharSequence!) Sets the content description of this node. |
open Unit |
setContentInvalid(contentInvalid: Boolean) Sets if the content of this node is invalid. |
open Unit |
setContextClickable(contextClickable: Boolean) Sets whether this node is context clickable. |
open Unit |
setDismissable(dismissable: Boolean) Sets if the node can be dismissed. |
open Unit |
setDrawingOrder(drawingOrderInParent: Int) Set the drawing order of the view corresponding it this node. |
open Unit |
setEditable(editable: Boolean) Sets whether this node is editable. |
open Unit |
setEnabled(enabled: Boolean) Sets whether this node is enabled. |
open Unit |
setError(error: CharSequence!) Sets the error text of this node. |
open Unit |
setExpandedState(state: Int) Sets the expanded state of the node. |
open Unit |
setFocusable(focusable: Boolean) Sets whether this node is focusable. |
open Unit |
setFocused(focused: Boolean) Sets whether this node is focused. |
open Unit |
setGranularScrollingSupported(granularScrollingSupported: Boolean) Sets if the node supports granular scrolling. |
open Unit |
setHeading(isHeading: Boolean) Sets whether the node represents a heading. |
open Unit |
setHintText(hintText: CharSequence!) Sets the hint text of this node. |
open Unit |
setImportantForAccessibility(important: Boolean) Sets whether the node is considered important for accessibility. |
open Unit |
setInputType(inputType: Int) Sets the input type of the source as defined by |
open Unit |
setLabelFor(labeled: View!) Sets the view for which the view represented by this info serves as a label for accessibility purposes. |
open Unit |
setLabelFor(root: View!, virtualDescendantId: Int) Sets the view for which the view represented by this info serves as a label for accessibility purposes. |
open Unit |
setLabeledBy(label: View!) Sets the view which serves as the label of the view represented by this info for accessibility purposes. |
open Unit |
setLabeledBy(root: View!, virtualDescendantId: Int) Sets the view which serves as the label of the view represented by this info for accessibility purposes. |
open Unit |
setLiveRegion(mode: Int) Sets the node's live region mode. |
open Unit |
setLongClickable(longClickable: Boolean) Sets whether this node is long clickable. |
open Unit |
setMaxTextLength(max: Int) Sets the maximum text length, or -1 for no limit. |
open Unit |
setMinDurationBetweenContentChanges(duration: Duration) Sets the minimum time duration between two content change events, which is used in throttling content change events in accessibility services. |
open Unit |
setMovementGranularities(granularities: Int) Sets the movement granularities for traversing the text of this node. |
open Unit |
setMultiLine(multiLine: Boolean) Sets if the node is a multi line editable text. |
open Unit |
setPackageName(packageName: CharSequence!) Sets the package this node comes from. |
open Unit |
setPaneTitle(paneTitle: CharSequence?) 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. |
open Unit |
Sets the parent. |
open Unit |
Sets the parent to be a virtual descendant of the given |
open Unit |
setPassword(password: Boolean) Sets whether this node is a password. |
open Unit |
setQueryFromAppProcessEnabled(view: View, enabled: Boolean) Connects this node to the View's root so that operations on this node can query the entire |
open Unit |
setRangeInfo(rangeInfo: AccessibilityNodeInfo.RangeInfo!) Sets the range info if this node is a range. |
open Unit |
setRequestInitialAccessibilityFocus(requestInitialAccessibilityFocus: Boolean) Sets whether the node has requested initial accessibility focus. |
open Unit |
setScreenReaderFocusable(screenReaderFocusable: Boolean) Sets whether the node should be considered a focusable unit by a screen reader. |
open Unit |
setScrollable(scrollable: Boolean) Sets if the node is scrollable. |
open Unit |
setSelected(selected: Boolean) Sets whether this node is selected. |
open Unit |
setShowingHintText(showingHintText: Boolean) Sets whether the node's text represents a hint for the user to enter text. |
open Unit |
Sets the source. |
open Unit |
Sets the source to be a virtual descendant of the given |
open Unit |
setStateDescription(stateDescription: CharSequence?) Sets the state description of this node. |
open Unit |
setText(text: CharSequence!) Sets the text of this node. |
open Unit |
setTextEntryKey(isTextEntryKey: Boolean) Sets whether the node represents a text entry key that is part of a keyboard or keypad. |
open Unit |
setTextSelectable(selectableText: Boolean) Sets if the node has selectable text. |
open Unit |
setTextSelection(start: Int, end: Int) Sets the text selection start and end. |
open Unit |
setTooltipText(tooltipText: CharSequence?) Sets the tooltip text of this node. |
open Unit |
setTouchDelegateInfo(delegatedInfo: AccessibilityNodeInfo.TouchDelegateInfo) Set touch delegate info if the represented view has a |
open Unit |
setTraversalAfter(view: View!) Sets the view whose node is visited after this one in accessibility traversal. |
open Unit |
setTraversalAfter(root: View!, virtualDescendantId: Int) Sets the node after which this one is visited in accessibility traversal. |
open Unit |
setTraversalBefore(view: View!) Sets the view before whose node this one should be visited during traversal. |
open Unit |
setTraversalBefore(root: View!, virtualDescendantId: Int) Sets the node before which this one is visited during traversal. |
open Unit |
setUniqueId(uniqueId: String?) Sets the unique id to act as a key to identify the node. |
open Unit |
setViewIdResourceName(viewIdResName: String!) Sets the fully qualified resource name of the source view's id. |
open Unit |
setVisibleToUser(visibleToUser: Boolean) Sets whether this node is visible to the user. |
open String |
toString() |
open Unit |
writeToParcel(parcel: Parcel, flags: Int) Flatten this object in to a Parcel. |
Properties | |
---|---|
static Parcelable.Creator<AccessibilityNodeInfo!> |
Constants
ACTION_ACCESSIBILITY_FOCUS
static val ACTION_ACCESSIBILITY_FOCUS: Int
Action that gives accessibility focus to the node. See AccessibilityAction.ACTION_ACCESSIBILITY_FOCUS
Value: 64
ACTION_ARGUMENT_COLUMN_INT
static val ACTION_ARGUMENT_COLUMN_INT: String
Argument for specifying the collection column to make visible on screen.
Type: int
Actions:
Value: "android.view.accessibility.action.ARGUMENT_COLUMN_INT"
ACTION_ARGUMENT_DIRECTION_INT
static val ACTION_ARGUMENT_DIRECTION_INT: String
Argument to represent the direction when using AccessibilityAction.ACTION_SCROLL_IN_DIRECTION
.
The value of this argument can be one of:
View.FOCUS_DOWN
View.FOCUS_UP
View.FOCUS_LEFT
View.FOCUS_RIGHT
View.FOCUS_FORWARD
View.FOCUS_BACKWARD
Value: "android.view.accessibility.action.ARGUMENT_DIRECTION_INT"
ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN
static val ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN: String
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
Value: "ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN"
ACTION_ARGUMENT_HTML_ELEMENT_STRING
static val ACTION_ARGUMENT_HTML_ELEMENT_STRING: String
Argument for which HTML element to get moving to the next/previous HTML element.
Type: String
Actions:
Value: "ACTION_ARGUMENT_HTML_ELEMENT_STRING"
ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT
static val ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT: String
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
Value: "ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT"
ACTION_ARGUMENT_MOVE_WINDOW_X
static val ACTION_ARGUMENT_MOVE_WINDOW_X: String
Argument for specifying the x coordinate to which to move a window.
Type: int
Actions:
Value: "ACTION_ARGUMENT_MOVE_WINDOW_X"
ACTION_ARGUMENT_MOVE_WINDOW_Y
static val ACTION_ARGUMENT_MOVE_WINDOW_Y: String
Argument for specifying the y coordinate to which to move a window.
Type: int
Actions:
Value: "ACTION_ARGUMENT_MOVE_WINDOW_Y"
ACTION_ARGUMENT_PRESS_AND_HOLD_DURATION_MILLIS_INT
static val ACTION_ARGUMENT_PRESS_AND_HOLD_DURATION_MILLIS_INT: String
Argument to represent the duration in milliseconds to press and hold a node.
Type: int
Actions:
Value: "android.view.accessibility.action.ARGUMENT_PRESS_AND_HOLD_DURATION_MILLIS_INT"
ACTION_ARGUMENT_PROGRESS_VALUE
static val ACTION_ARGUMENT_PROGRESS_VALUE: String
Argument for specifying the progress value to set.
Type: float
Actions:
Value: "android.view.accessibility.action.ARGUMENT_PROGRESS_VALUE"
ACTION_ARGUMENT_ROW_INT
static val ACTION_ARGUMENT_ROW_INT: String
Argument for specifying the collection row to make visible on screen.
Type: int
Actions:
Value: "android.view.accessibility.action.ARGUMENT_ROW_INT"
ACTION_ARGUMENT_SCROLL_AMOUNT_FLOAT
static val ACTION_ARGUMENT_SCROLL_AMOUNT_FLOAT: String
Argument to represent the scroll amount as a percent of the visible area of a node, with 1.0F as the default. Values smaller than 1.0F represent a partial scroll of the node, and values larger than 1.0F represent a scroll that extends beyond the currently visible node Rect. Setting this to Float.POSITIVE_INFINITY
or to another "too large" value should scroll to the end of the node. Negative values should not be used with this argument.
This argument should be used with the following scroll actions:
AccessibilityAction.ACTION_SCROLL_FORWARD
AccessibilityAction.ACTION_SCROLL_BACKWARD
AccessibilityAction.ACTION_SCROLL_UP
AccessibilityAction.ACTION_SCROLL_DOWN
AccessibilityAction.ACTION_SCROLL_LEFT
AccessibilityAction.ACTION_SCROLL_RIGHT
Example: if a view representing a list of items implements AccessibilityAction.ACTION_SCROLL_FORWARD
to scroll forward by an entire screen (one "page"), then passing a value of .25F via this argument should scroll that view only by 1/4th of a screen. Passing a value of 1.50F via this argument should scroll the view by 1 1/2 screens or to end of the node if the node doesn't extend to 1 1/2 screens.
This argument should not be used with the following scroll actions, which don't cleanly conform to granular scroll semantics:
Views that support this argument should set setGranularScrollingSupported(boolean)
to true. Clients should use isGranularScrollingSupported()
to check if granular scrolling is supported.
Value: "android.view.accessibility.action.ARGUMENT_SCROLL_AMOUNT_FLOAT"
ACTION_ARGUMENT_SELECTION_END_INT
static val ACTION_ARGUMENT_SELECTION_END_INT: String
Argument for specifying the selection end.
Type: int
Actions:
Value: "ACTION_ARGUMENT_SELECTION_END_INT"
ACTION_ARGUMENT_SELECTION_START_INT
static val ACTION_ARGUMENT_SELECTION_START_INT: String
Argument for specifying the selection start.
Type: int
Actions:
Value: "ACTION_ARGUMENT_SELECTION_START_INT"
ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE
static val ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE: String
Argument for specifying the text content to set.
Type: CharSequence
Actions:
Value: "ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE"
ACTION_CLEAR_ACCESSIBILITY_FOCUS
static val ACTION_CLEAR_ACCESSIBILITY_FOCUS: Int
Action that clears accessibility focus of the node. See AccessibilityAction.ACTION_CLEAR_ACCESSIBILITY_FOCUS
Value: 128
ACTION_CLEAR_FOCUS
static val ACTION_CLEAR_FOCUS: Int
Action that clears input focus of the node. See AccessibilityAction.ACTION_CLEAR_FOCUS
Value: 2
ACTION_CLEAR_SELECTION
static val ACTION_CLEAR_SELECTION: Int
Action that deselects the node.
Value: 8
ACTION_CLICK
static val ACTION_CLICK: Int
Action that clicks on the node info.
Value: 16
ACTION_COLLAPSE
static val ACTION_COLLAPSE: Int
Action to collapse an expandable node.
Value: 524288
ACTION_COPY
static val ACTION_COPY: Int
Action to copy the current selection to the clipboard.
Value: 16384
ACTION_CUT
static val ACTION_CUT: Int
Action to cut the current selection and place it to the clipboard.
Value: 65536
ACTION_DISMISS
static val ACTION_DISMISS: Int
Action to dismiss a dismissable node.
Value: 1048576
ACTION_EXPAND
static val ACTION_EXPAND: Int
Action to expand an expandable node.
Value: 262144
ACTION_FOCUS
static val ACTION_FOCUS: Int
Action that gives input focus to the node. See AccessibilityAction.ACTION_FOCUS
Value: 1
ACTION_LONG_CLICK
static val ACTION_LONG_CLICK: Int
Action that long clicks on the node.
It does not support coordinate information for anchoring.
Value: 32
ACTION_NEXT_AT_MOVEMENT_GRANULARITY
static val ACTION_NEXT_AT_MOVEMENT_GRANULARITY: Int
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.
<p><code> 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); </code></p>
Value: 256
ACTION_NEXT_HTML_ELEMENT
static val ACTION_NEXT_HTML_ELEMENT: Int
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:
<p><code> Bundle arguments = new Bundle(); arguments.putString(AccessibilityNodeInfo.ACTION_ARGUMENT_HTML_ELEMENT_STRING, "BUTTON"); info.performAction(AccessibilityNodeInfo.ACTION_NEXT_HTML_ELEMENT, arguments); </code></p>
Value: 1024
ACTION_PASTE
static val ACTION_PASTE: Int
Action to paste the current clipboard content.
Value: 32768
ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY
static val ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY: Int
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.
<p><code> 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); </code></p>
Value: 512
ACTION_PREVIOUS_HTML_ELEMENT
static val ACTION_PREVIOUS_HTML_ELEMENT: Int
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:
<p><code> Bundle arguments = new Bundle(); arguments.putString(AccessibilityNodeInfo.ACTION_ARGUMENT_HTML_ELEMENT_STRING, "BUTTON"); info.performAction(AccessibilityNodeInfo.ACTION_PREVIOUS_HTML_ELEMENT, arguments); </code></p>
Value: 2048
ACTION_SCROLL_BACKWARD
static val ACTION_SCROLL_BACKWARD: Int
Action to scroll the node content backward.
Value: 8192
ACTION_SCROLL_FORWARD
static val ACTION_SCROLL_FORWARD: Int
Action to scroll the node content forward.
Value: 4096
ACTION_SELECT
static val ACTION_SELECT: Int
Action that selects the node.
Value: 4
ACTION_SET_SELECTION
static val ACTION_SET_SELECTION: Int
Action to set the selection. Performing this action with no arguments clears the selection.
Value: 131072
ACTION_SET_TEXT
static val ACTION_SET_TEXT: Int
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.
Value: 2097152
CHECKED_STATE_FALSE
static val CHECKED_STATE_FALSE: Int
This node is not checked.
Value: 0
CHECKED_STATE_PARTIAL
static val CHECKED_STATE_PARTIAL: Int
This node is partially checked. For example, when a checkbox owns a number of sub-options and they have different states, then the main checkbox is in a partially-checked state.
Value: 2
CHECKED_STATE_TRUE
static val CHECKED_STATE_TRUE: Int
This node is checked.
Value: 1
EXPANDED_STATE_COLLAPSED
static val EXPANDED_STATE_COLLAPSED: Int
Expanded state for a collapsed expandable element.
Value: 1
EXPANDED_STATE_FULL
static val EXPANDED_STATE_FULL: Int
Expanded state for a expanded expandable element that cannot be expanded further.
Value: 3
EXPANDED_STATE_PARTIAL
static val EXPANDED_STATE_PARTIAL: Int
Expanded state for an expanded expandable element that can still be expanded further.
Value: 2
EXPANDED_STATE_UNDEFINED
static val EXPANDED_STATE_UNDEFINED: Int
Expanded state for a non-expandable element
Value: 0
EXTRA_DATA_RENDERING_INFO_KEY
static val EXTRA_DATA_RENDERING_INFO_KEY: String
Key used to request extra data for the rendering information. The key requests that a AccessibilityNodeInfo.ExtraRenderingInfo
be added to this info. This request is made with refreshWithExtraData(java.lang.String,android.os.Bundle)
without argument.
The data can be retrieved from the ExtraRenderingInfo
returned by getExtraRenderingInfo()
using ExtraRenderingInfo.getLayoutSize
, ExtraRenderingInfo.getTextSizeInPx()
and ExtraRenderingInfo.getTextSizeUnit()
. For layout params, it is supported by both TextView
and ViewGroup
. For text size and unit, it is only supported by TextView
.
Value: "android.view.accessibility.extra.DATA_RENDERING_INFO_KEY"
EXTRA_DATA_TEXT_CHARACTER_LOCATION_ARG_LENGTH
static val EXTRA_DATA_TEXT_CHARACTER_LOCATION_ARG_LENGTH: String
Integer argument specifying the end index of the requested text location data. Must be positive and no larger than EXTRA_DATA_TEXT_CHARACTER_LOCATION_ARG_MAX_LENGTH
.
Value: "android.view.accessibility.extra.DATA_TEXT_CHARACTER_LOCATION_ARG_LENGTH"
EXTRA_DATA_TEXT_CHARACTER_LOCATION_ARG_MAX_LENGTH
static val EXTRA_DATA_TEXT_CHARACTER_LOCATION_ARG_MAX_LENGTH: Int
The maximum allowed length of the requested text location data.
Value: 20000
EXTRA_DATA_TEXT_CHARACTER_LOCATION_ARG_START_INDEX
static val EXTRA_DATA_TEXT_CHARACTER_LOCATION_ARG_START_INDEX: String
Integer argument specifying the start index of the requested text location data. Must be valid inside the CharSequence returned by getText()
.
Value: "android.view.accessibility.extra.DATA_TEXT_CHARACTER_LOCATION_ARG_START_INDEX"
EXTRA_DATA_TEXT_CHARACTER_LOCATION_KEY
static val EXTRA_DATA_TEXT_CHARACTER_LOCATION_KEY: String
Key used to request and locate extra data for text character location. This key requests that an array of android.graphics.RectF
s be added to the extras. This request is made with refreshWithExtraData(java.lang.String,android.os.Bundle)
. The arguments taken by this request are two integers: EXTRA_DATA_TEXT_CHARACTER_LOCATION_ARG_START_INDEX
and EXTRA_DATA_TEXT_CHARACTER_LOCATION_ARG_LENGTH
. The starting index must be valid inside the CharSequence returned by getText()
, and the length must be positive.
The data can be retrieved from the Bundle
returned by getExtras()
using this string as a key for Bundle.getParcelableArray(String, Class)
. The android.graphics.RectF
will be null
for characters that either do not exist or are off the screen.
Note that character locations returned are modified by changes in display magnification. {@see #refreshWithExtraData(String, Bundle)}
Value: "android.view.accessibility.extra.DATA_TEXT_CHARACTER_LOCATION_KEY"
FLAG_PREFETCH_ANCESTORS
static val FLAG_PREFETCH_ANCESTORS: Int
Prefetching strategy that prefetches the ancestors of the requested node.
Ancestors will be prefetched before siblings and descendants.
Value: 1
FLAG_PREFETCH_DESCENDANTS_BREADTH_FIRST
static val FLAG_PREFETCH_DESCENDANTS_BREADTH_FIRST: Int
Prefetching strategy that prefetches the descendants of the requested node breadth-first.
This must not be combined with FLAG_PREFETCH_DESCENDANTS_HYBRID
or FLAG_PREFETCH_DESCENDANTS_DEPTH_FIRST
or this will trigger an IllegalArgumentException.
See FLAG_PREFETCH_ANCESTORS
for information on where these flags can be used.
Value: 16
FLAG_PREFETCH_DESCENDANTS_DEPTH_FIRST
static val FLAG_PREFETCH_DESCENDANTS_DEPTH_FIRST: Int
Prefetching strategy that prefetches the descendants of the requested node depth-first.
This must not be combined with FLAG_PREFETCH_DESCENDANTS_HYBRID
or FLAG_PREFETCH_DESCENDANTS_BREADTH_FIRST
or this will trigger an IllegalArgumentException.
See FLAG_PREFETCH_ANCESTORS
for information on where these flags can be used.
Value: 8
FLAG_PREFETCH_DESCENDANTS_HYBRID
static val FLAG_PREFETCH_DESCENDANTS_HYBRID: Int
Prefetching strategy that prefetches the descendants in a hybrid depth first and breadth first approach.
The children of the root node is prefetched before recursing on the children. This must not be combined with FLAG_PREFETCH_DESCENDANTS_DEPTH_FIRST
or FLAG_PREFETCH_DESCENDANTS_BREADTH_FIRST
or this will trigger an IllegalArgumentException.
See FLAG_PREFETCH_ANCESTORS
for information on where these flags can be used.
Value: 4
FLAG_PREFETCH_SIBLINGS
static val FLAG_PREFETCH_SIBLINGS: Int
Prefetching strategy that prefetches the siblings of the requested node.
To avoid disconnected trees, this flag will also prefetch the parent. Siblings will be prefetched before descendants.
See FLAG_PREFETCH_ANCESTORS
for information on where these flags can be used.
Value: 2
FLAG_PREFETCH_UNINTERRUPTIBLE
static val FLAG_PREFETCH_UNINTERRUPTIBLE: Int
Prefetching flag that specifies prefetching should not be interrupted by a request to retrieve a node or perform an action on a node.
See FLAG_PREFETCH_ANCESTORS
for information on where these flags can be used.
Value: 32
FOCUS_ACCESSIBILITY
static val FOCUS_ACCESSIBILITY: Int
The accessibility focus.
Value: 2
MAX_NUMBER_OF_PREFETCHED_NODES
static val MAX_NUMBER_OF_PREFETCHED_NODES: Int
Maximum batch size of prefetched nodes for a request.
Value: 50
MOVEMENT_GRANULARITY_CHARACTER
static val MOVEMENT_GRANULARITY_CHARACTER: Int
Movement granularity bit for traversing the text of a node by character.
Value: 1
MOVEMENT_GRANULARITY_LINE
static val MOVEMENT_GRANULARITY_LINE: Int
Movement granularity bit for traversing the text of a node by line.
Value: 4
MOVEMENT_GRANULARITY_PAGE
static val MOVEMENT_GRANULARITY_PAGE: Int
Movement granularity bit for traversing the text of a node by page.
Value: 16
MOVEMENT_GRANULARITY_PARAGRAPH
static val MOVEMENT_GRANULARITY_PARAGRAPH: Int
Movement granularity bit for traversing the text of a node by paragraph.
Value: 8
MOVEMENT_GRANULARITY_WORD
static val MOVEMENT_GRANULARITY_WORD: Int
Movement granularity bit for traversing the text of a node by word.
Value: 2
Public constructors
AccessibilityNodeInfo
AccessibilityNodeInfo()
Creates a new AccessibilityNodeInfo
.
AccessibilityNodeInfo
AccessibilityNodeInfo(info: AccessibilityNodeInfo)
Copy constructor. Creates a new AccessibilityNodeInfo
, and this new instance is initialized from the given info
.
Parameters | |
---|---|
info |
AccessibilityNodeInfo: The other info. This value cannot be null . |
AccessibilityNodeInfo
AccessibilityNodeInfo(source: View)
Creates a new AccessibilityNodeInfo
with the given source
.
Parameters | |
---|---|
source |
View: The source view. This value cannot be null . |
AccessibilityNodeInfo
AccessibilityNodeInfo(
root: View,
virtualDescendantId: Int)
Creates a new AccessibilityNodeInfo
with the given source
.
Parameters | |
---|---|
root |
View: The root of the virtual subtree. This value cannot be null . |
virtualDescendantId |
Int: The id of the virtual descendant. |
Public methods
addAction
open fun addAction(action: AccessibilityNodeInfo.AccessibilityAction!): Unit
Adds an action that can be performed on the node.
To add a standard action use the static constants on AccessibilityAction
. To add a custom action create a new AccessibilityAction
by passing in a resource id from your application as the action id and an optional label that describes the action. To override one of the standard actions use as the action id of a standard action id such as ACTION_CLICK
and an optional label that describes the action.
Use androidx.core.view.ViewCompat#addAccessibilityAction(View, CharSequence, * AccessibilityViewCommand) to register an action directly on the view.
Note: Cannot be called from an android.accessibilityservice.AccessibilityService
. This class is made immutable before being delivered to an AccessibilityService.
Parameters | |
---|---|
action |
AccessibilityNodeInfo.AccessibilityAction!: The action. |
Exceptions | |
---|---|
java.lang.IllegalStateException |
If called from an AccessibilityService. |
addAction
open funaddAction(action: Int): Unit
Deprecated: 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 android.accessibilityservice.AccessibilityService
. This class is made immutable before being delivered to an AccessibilityService.
Parameters | |
---|---|
action |
Int: The action. |
Exceptions | |
---|---|
java.lang.IllegalStateException |
If called from an AccessibilityService. |
java.lang.IllegalArgumentException |
If the argument is not one of the standard actions. |
addChild
open fun addChild(child: View!): Unit
Adds a child.
Note: Cannot be called from an android.accessibilityservice.AccessibilityService
. This class is made immutable before being delivered to an AccessibilityService. Note that a view cannot be made its own child.
Parameters | |
---|---|
child |
View!: The child. |
Exceptions | |
---|---|
java.lang.IllegalStateException |
If called from an AccessibilityService. |
addChild
open fun addChild(
root: View!,
virtualDescendantId: Int
): Unit
Adds a virtual child which is a descendant of the given root
. If virtualDescendantId
is View.NO_ID
the root is added as a child.
A virtual descendant is an imaginary View that is reported as a part of the view hierarchy for accessibility purposes. This enables custom views that draw complex content to report them selves as a tree of virtual views, thus conveying their logical structure. Note that a view cannot be made its own child.
Parameters | |
---|---|
root |
View!: The root of the virtual subtree. |
virtualDescendantId |
Int: The id of the virtual child. |
addLabeledBy
open fun addLabeledBy(label: View): Unit
Adds the view which serves as the label of the view represented by this info for accessibility purposes. When multiple labels are added, the content from each label is combined in the order that they are added.
If visible text can be used to describe or give meaning to this UI, this method is preferred. For example, a TextView before an EditText in the UI usually specifies what information is contained in the EditText. Hence, the EditText is labeled by the TextView.
Parameters | |
---|---|
label |
View: A view that labels this node's source. This value cannot be null . |
addLabeledBy
open fun addLabeledBy(
root: View,
virtualDescendantId: Int
): Unit
Adds the view which serves as the label of the view represented by this info for accessibility purposes. If virtualDescendantId
is View.NO_ID
the root is set as the label. When multiple labels are added, the content from each label is combined in the order that they are added.
A virtual descendant is an imaginary View that is reported as a part of the view hierarchy for accessibility purposes. This enables custom views that draw complex content to report themselves as a tree of virtual views, thus conveying their logical structure.
If visible text can be used to describe or give meaning to this UI, this method is preferred. For example, a TextView before an EditText in the UI usually specifies what information is contained in the EditText. Hence, the EditText is labeled by the TextView.
Note: Cannot be called from an android.accessibilityservice.AccessibilityService
. This class is made immutable before being delivered to an AccessibilityService.
Parameters | |
---|---|
root |
View: A root whose virtual descendant labels this node's source. This value cannot be null . |
virtualDescendantId |
Int: The id of the virtual descendant. |
canOpenPopup
open fun canOpenPopup(): Boolean
Gets if this node opens a popup or a dialog.
Return | |
---|---|
Boolean |
If the the node opens a popup. |
describeContents
open fun describeContents(): Int
Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. For example, if the object will include a file descriptor in the output of writeToParcel(android.os.Parcel,int)
, the return value of this method must include the CONTENTS_FILE_DESCRIPTOR
bit.
Return | |
---|---|
Int |
a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either 0 or android.os.Parcelable#CONTENTS_FILE_DESCRIPTOR |
equals
open fun equals(other: Any?): Boolean
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
.
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.
Parameters | |
---|---|
obj |
the reference object with which to compare. |
object |
This value may be null . |
Return | |
---|---|
Boolean |
true if this object is the same as the obj argument; false otherwise. |
findAccessibilityNodeInfosByText
open fun findAccessibilityNodeInfosByText(text: String!): MutableList<AccessibilityNodeInfo!>!
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: If this view hierarchy has a SurfaceView
embedding another view hierarchy via SurfaceView.setChildSurfacePackage
, there is a limitation that this API won't be able to find the node for the view on the embedded view hierarchy. It's because views don't know about the embedded hierarchies. Instead, you could traverse all the children to find the node.
Parameters | |
---|---|
text |
String!: The searched text. |
Return | |
---|---|
MutableList<AccessibilityNodeInfo!>! |
A list of node info. |
findAccessibilityNodeInfosByViewId
open fun findAccessibilityNodeInfosByViewId(viewId: String): MutableList<AccessibilityNodeInfo!>!
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: The primary usage of this API is for UI test automation and in order to report the fully qualified view id if an AccessibilityNodeInfo
the client has to set the AccessibilityServiceInfo.FLAG_REPORT_VIEW_IDS
flag when configuring the android.accessibilityservice.AccessibilityService
.
Note: If this view hierarchy has a SurfaceView
embedding another view hierarchy via SurfaceView.setChildSurfacePackage
, there is a limitation that this API won't be able to find the node for the view on the embedded view hierarchy. It's because views don't know about the embedded hierarchies. Instead, you could traverse all the children to find the node.
Parameters | |
---|---|
viewId |
String: The fully qualified resource name of the view id to find. This value cannot be null . |
Return | |
---|---|
MutableList<AccessibilityNodeInfo!>! |
A list of node info. |
findFocus
open fun findFocus(focus: Int): AccessibilityNodeInfo!
Find the view that has the specified focus type. The search starts from the view represented by this node info.
Note: If this view hierarchy has a SurfaceView
embedding another view hierarchy via SurfaceView.setChildSurfacePackage
, there is a limitation that this API won't be able to find the node for the view on the embedded view hierarchy. It's because views don't know about the embedded hierarchies. Instead, you could traverse all the children to find the node. Or, use AccessibilityService.findFocus(int)
for FOCUS_ACCESSIBILITY
only since it has no such limitation.
Parameters | |
---|---|
focus |
Int: The focus to find. One of FOCUS_INPUT or FOCUS_ACCESSIBILITY . |
Return | |
---|---|
AccessibilityNodeInfo! |
The node info of the focused view or null. |
See Also
focusSearch
open fun focusSearch(direction: Int): AccessibilityNodeInfo!
Searches for the nearest view in the specified direction that can take the input focus.
Note: If this view hierarchy has a SurfaceView
embedding another view hierarchy via SurfaceView.setChildSurfacePackage
, there is a limitation that this API won't be able to find the node for the view in the specified direction on the embedded view hierarchy. It's because views don't know about the embedded hierarchies. Instead, you could traverse all the children to find the node.
Parameters | |
---|---|
direction |
Int: The direction. Can be one of: View.FOCUS_DOWN , View.FOCUS_UP , View.FOCUS_LEFT , View.FOCUS_RIGHT , View.FOCUS_FORWARD , View.FOCUS_BACKWARD . |
Return | |
---|---|
AccessibilityNodeInfo! |
The node info for the view that can take accessibility focus. |
getActionList
open fun getActionList(): MutableList<AccessibilityNodeInfo.AccessibilityAction!>!
Gets the actions that can be performed on the node.
getActions
open fungetActions(): Int
Deprecated: Use getActionList()
.
Gets the actions that can be performed on the node.
Return | |
---|---|
Int |
The bit mask of with actions. |
See Also
android.view.accessibility.AccessibilityNodeInfo#ACTION_FOCUS
android.view.accessibility.AccessibilityNodeInfo#ACTION_CLEAR_FOCUS
android.view.accessibility.AccessibilityNodeInfo#ACTION_SELECT
android.view.accessibility.AccessibilityNodeInfo#ACTION_CLEAR_SELECTION
android.view.accessibility.AccessibilityNodeInfo#ACTION_ACCESSIBILITY_FOCUS
android.view.accessibility.AccessibilityNodeInfo#ACTION_CLEAR_ACCESSIBILITY_FOCUS
android.view.accessibility.AccessibilityNodeInfo#ACTION_CLICK
android.view.accessibility.AccessibilityNodeInfo#ACTION_LONG_CLICK
android.view.accessibility.AccessibilityNodeInfo#ACTION_NEXT_AT_MOVEMENT_GRANULARITY
android.view.accessibility.AccessibilityNodeInfo#ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY
android.view.accessibility.AccessibilityNodeInfo#ACTION_NEXT_HTML_ELEMENT
android.view.accessibility.AccessibilityNodeInfo#ACTION_PREVIOUS_HTML_ELEMENT
android.view.accessibility.AccessibilityNodeInfo#ACTION_SCROLL_FORWARD
android.view.accessibility.AccessibilityNodeInfo#ACTION_SCROLL_BACKWARD
getAvailableExtraData
open fun getAvailableExtraData(): MutableList<String!>!
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)
.
Return | |
---|---|
MutableList<String!>! |
An unmodifiable list of keys corresponding to extra data that can be requested. |
getBoundsInParent
open fungetBoundsInParent(outBounds: Rect!): Unit
Deprecated: Use getBoundsInScreen(android.graphics.Rect)
instead.
Gets the node bounds in the viewParent's coordinates. getParent()
does not represent the source's viewParent. Instead it represents the result of View.getParentForAccessibility()
, which returns the closest ancestor where View.isImportantForAccessibility()
is true. So this method is not reliable.
When magnification is enabled, the bounds in parent are also scaled up by magnification scale. For example, it returns Rect(20, 20, 200, 200) for original bounds Rect(10, 10, 100, 100), when the magnification scale is 2.
Parameters | |
---|---|
outBounds |
Rect!: The output node bounds. |
getBoundsInScreen
open fun getBoundsInScreen(outBounds: Rect!): Unit
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. |
getBoundsInWindow
open fun getBoundsInWindow(outBounds: Rect): Unit
Gets the node bounds in window coordinates.
The node bounds returned are not scaled by magnification.
Parameters | |
---|---|
outBounds |
Rect: The output node bounds. This value cannot be null . |
getChecked
open fun getChecked(): Int
Gets the checked state of this node. This is only meaningful when isCheckable()
returns true
.
getChild
open fun getChild(index: Int): AccessibilityNodeInfo!
Get the child at given index.
Parameters | |
---|---|
index |
Int: The child index. |
Return | |
---|---|
AccessibilityNodeInfo! |
The child node. |
Exceptions | |
---|---|
java.lang.IllegalStateException |
If called outside of an AccessibilityService and before calling setQueryFromAppProcessEnabled . |
getChild
open fun getChild(
index: Int,
prefetchingStrategy: Int
): AccessibilityNodeInfo?
Get the child at given index.
See getParent(int)
for a description of prefetching.
Parameters | |
---|---|
index |
Int: The child index. |
prefetchingStrategy |
Int: the prefetching strategy. Value is either 0 or a combination of android.view.accessibility.AccessibilityNodeInfo#FLAG_PREFETCH_ANCESTORS , android.view.accessibility.AccessibilityNodeInfo#FLAG_PREFETCH_SIBLINGS , android.view.accessibility.AccessibilityNodeInfo#FLAG_PREFETCH_DESCENDANTS_HYBRID , android.view.accessibility.AccessibilityNodeInfo#FLAG_PREFETCH_DESCENDANTS_DEPTH_FIRST , android.view.accessibility.AccessibilityNodeInfo#FLAG_PREFETCH_DESCENDANTS_BREADTH_FIRST , and android.view.accessibility.AccessibilityNodeInfo#FLAG_PREFETCH_UNINTERRUPTIBLE |
Return | |
---|---|
AccessibilityNodeInfo? |
The child node. This value may be null . |
Exceptions | |
---|---|
java.lang.IllegalStateException |
If called outside of an AccessibilityService and before calling setQueryFromAppProcessEnabled . |
getChildCount
open fun getChildCount(): Int
Gets the number of children.
Return | |
---|---|
Int |
The child count. |
getClassName
open fun getClassName(): CharSequence!
Gets the class this node comes from.
Return | |
---|---|
CharSequence! |
The class name. |
getCollectionInfo
open fun getCollectionInfo(): AccessibilityNodeInfo.CollectionInfo!
Gets the collection info if the node is a collection. A collection child is always a collection item.
Return | |
---|---|
AccessibilityNodeInfo.CollectionInfo! |
The collection info. |
getCollectionItemInfo
open fun getCollectionItemInfo(): AccessibilityNodeInfo.CollectionItemInfo!
Gets the collection item info if the node is a collection item. A collection item is always a child of a collection.
Return | |
---|---|
AccessibilityNodeInfo.CollectionItemInfo! |
The collection item info. |
getContainerTitle
open fun getContainerTitle(): CharSequence?
Returns the container title.
Return | |
---|---|
CharSequence? |
This value may be null . |
See Also
getContentDescription
open fun getContentDescription(): CharSequence!
Gets the content description of this node.
Return | |
---|---|
CharSequence! |
The content description. |
getDrawingOrder
open fun getDrawingOrder(): Int
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.
Return | |
---|---|
Int |
The drawing position of the view corresponding to this node relative to its siblings. |
getError
open fun getError(): CharSequence!
Gets the error text of this node.
Return | |
---|---|
CharSequence! |
The error text. |
getExpandedState
open fun getExpandedState(): Int
Gets the expanded state for this node.
getExtraRenderingInfo
open fun getExtraRenderingInfo(): AccessibilityNodeInfo.ExtraRenderingInfo?
Gets the extra rendering info
if the node is meant to be refreshed with extra data to examine rendering related accessibility issues.
Return | |
---|---|
AccessibilityNodeInfo.ExtraRenderingInfo? |
The extra rendering info . This value may be null . |
getExtras
open fun getExtras(): Bundle!
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.
Return | |
---|---|
Bundle! |
The bundle. |
getHintText
open fun getHintText(): CharSequence!
Gets the hint text of this node. Only applies to nodes where text can be entered.
Return | |
---|---|
CharSequence! |
The hint text. |
getInputType
open fun getInputType(): Int
Gets the input type of the source as defined by InputType
.
Return | |
---|---|
Int |
The input type. |
getLabelFor
open fun getLabelFor(): AccessibilityNodeInfo!
Gets the node info for which the view represented by this info serves as a label for accessibility purposes.
Return | |
---|---|
AccessibilityNodeInfo! |
The labeled info. |
getLabeledBy
open fungetLabeledBy(): AccessibilityNodeInfo!
Deprecated: Use getLabeledByList()
instead.
Gets the node info which serves as the label of the view represented by this info for accessibility purposes.
Return | |
---|---|
AccessibilityNodeInfo! |
The label. |
getLabeledByList
open fun getLabeledByList(): MutableList<AccessibilityNodeInfo!>
Gets the list of node infos which serve as the labels of the view represented by this info for accessibility purposes.
Return | |
---|---|
MutableList<AccessibilityNodeInfo!> |
The list of labels in the order that they were added. This value cannot be null . |
getLiveRegion
open fun getLiveRegion(): Int
Gets the node's live region mode.
A live region is a node that contains information that is important for the user and when it changes the user should be notified. For example, a Snackbar that displays a confirmation notification should be marked as a live region with mode View.ACCESSIBILITY_LIVE_REGION_POLITE
.
It is the responsibility of the accessibility service to monitor AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED
events indicating changes to live region nodes and their children.
Return | |
---|---|
Int |
The live region mode, or View.ACCESSIBILITY_LIVE_REGION_NONE if the view is not a live region. |
getMaxTextLength
open fun getMaxTextLength(): Int
Returns the maximum text length for this node.
Return | |
---|---|
Int |
The maximum text length, or -1 for no limit. |
See Also
getMinDurationBetweenContentChanges
open fun getMinDurationBetweenContentChanges(): Duration
Gets the minimum time duration between two content change events.
Return | |
---|---|
Duration |
This value cannot be null . |
getMovementGranularities
open fun getMovementGranularities(): Int
Gets the movement granularities for traversing the text of this node.
Return | |
---|---|
Int |
The bit mask with granularities. |
getPackageName
open fun getPackageName(): CharSequence!
Gets the package this node comes from.
Return | |
---|---|
CharSequence! |
The package name. |
getPaneTitle
open fun getPaneTitle(): CharSequence?
Get the title of the pane represented by this node.
Return | |
---|---|
CharSequence? |
The title of the pane represented by this node, or null if this node does not represent a pane. |
getParent
open fun getParent(): AccessibilityNodeInfo!
Gets the parent.
Return | |
---|---|
AccessibilityNodeInfo! |
The parent. |
Exceptions | |
---|---|
java.lang.IllegalStateException |
If called outside of an AccessibilityService and before calling setQueryFromAppProcessEnabled . |
getParent
open fun getParent(prefetchingStrategy: Int): AccessibilityNodeInfo?
Gets the parent.
Use prefetchingStrategy
to determine the types of nodes prefetched from the app if the requested node is not in the cache and must be retrieved by the app. The default strategy for getParent()
is a combination of ancestor and sibling strategies. The app will prefetch until all nodes fulfilling the strategies are fetched, another node request is sent, or the maximum prefetch batch size of MAX_NUMBER_OF_PREFETCHED_NODES
nodes is reached. To prevent interruption by another request and to force prefetching of the max batch size, use AccessibilityNodeInfo.FLAG_PREFETCH_UNINTERRUPTIBLE
.
Return | |
---|---|
AccessibilityNodeInfo? |
The parent. This value may be null . |
Exceptions | |
---|---|
java.lang.IllegalStateException |
If called outside of an AccessibilityService and before calling setQueryFromAppProcessEnabled . |
getRangeInfo
open fun getRangeInfo(): AccessibilityNodeInfo.RangeInfo!
Gets the range info if this node is a range.
Return | |
---|---|
AccessibilityNodeInfo.RangeInfo! |
The range. |
getStateDescription
open fun getStateDescription(): CharSequence?
Get the state description of this node.
Return | |
---|---|
CharSequence? |
the state description This value may be null . |
getText
open fun getText(): CharSequence!
Gets the text of this node.
Note: If the text contains ClickableSpan
s or URLSpan
s, these spans will have been replaced with ones whose ClickableSpan.onClick(View)
can be called from an AccessibilityService
. When called from a service, the View
argument is ignored and the corresponding span will be found on the view that this AccessibilityNodeInfo
represents and called with that view as its argument.
This treatment of ClickableSpan
s means that the text returned from this method may different slightly one passed to setText(java.lang.CharSequence)
, although they will be equivalent according to TextUtils.equals(CharSequence, CharSequence)
. The ClickableSpan.onClick(View)
of any spans, however, will generally not work outside of an accessibility service.
Return | |
---|---|
CharSequence! |
The text. |
getTextSelectionEnd
open fun getTextSelectionEnd(): Int
Gets the text selection end if text is selected.
If no text is selected, both this method and AccessibilityNodeInfo.getTextSelectionStart()
return the same value: the current location of the cursor.
Return | |
---|---|
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
open fun getTextSelectionStart(): Int
Gets the text selection start or the cursor position.
If no text is selected, both this method and AccessibilityNodeInfo.getTextSelectionEnd()
return the same value: the current location of the cursor.
Return | |
---|---|
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
open fun getTooltipText(): CharSequence?
Gets the tooltip text of this node.
Return | |
---|---|
CharSequence? |
The tooltip text. This value may be null . |
getTouchDelegateInfo
open fun getTouchDelegateInfo(): AccessibilityNodeInfo.TouchDelegateInfo?
Get the TouchDelegateInfo
for touch delegate behavior with the represented view. It is possible for the same node to be pointed to by several regions. Use TouchDelegateInfo.getRegionAt(int)
to get touch delegate target Region
, and TouchDelegateInfo.getTargetForRegion(Region)
for AccessibilityNodeInfo
from the given region.
Return | |
---|---|
AccessibilityNodeInfo.TouchDelegateInfo? |
TouchDelegateInfo or null if there are no touch delegates. |
getTraversalAfter
open fun getTraversalAfter(): AccessibilityNodeInfo!
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.
Return | |
---|---|
AccessibilityNodeInfo! |
The succeeding node if such or null . |
getTraversalBefore
open fun getTraversalBefore(): AccessibilityNodeInfo!
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.
Return | |
---|---|
AccessibilityNodeInfo! |
The succeeding node if such or null . |
getUniqueId
open fun getUniqueId(): String?
Gets the unique id of the node.
Return | |
---|---|
String? |
The unique id This value may be null . |
getViewIdResourceName
open fun getViewIdResourceName(): String!
Gets the fully qualified resource name of the source view's id.
Note: The primary usage of this API is for UI test automation and in order to report the source view id of an AccessibilityNodeInfo
the client has to set the AccessibilityServiceInfo.FLAG_REPORT_VIEW_IDS
flag when configuring the android.accessibilityservice.AccessibilityService
.
Return | |
---|---|
String! |
The id resource name. |
getWindow
open fun getWindow(): AccessibilityWindowInfo!
Gets the window to which this node belongs.
Return | |
---|---|
AccessibilityWindowInfo! |
The window. |
getWindowId
open fun getWindowId(): Int
Gets the id of the window from which the info comes from.
Return | |
---|---|
Int |
The window id. |
hasRequestInitialAccessibilityFocus
open fun hasRequestInitialAccessibilityFocus(): Boolean
Gets whether the node has setRequestInitialAccessibilityFocus
.
Return | |
---|---|
Boolean |
True if the node has requested initial accessibility focus. |
hashCode
open fun hashCode(): Int
Return | |
---|---|
Int |
a hash code value for this object. |
isAccessibilityDataSensitive
open fun isAccessibilityDataSensitive(): Boolean
Gets if the node's accessibility data is considered sensitive.
Return | |
---|---|
Boolean |
True if the node's data is considered sensitive, false otherwise. |
isAccessibilityFocused
open fun isAccessibilityFocused(): Boolean
Gets whether this node is accessibility focused.
This is distinct from isFocused()
, which is used to track system focus. See ACTION_ACCESSIBILITY_FOCUS
for details.
Return | |
---|---|
Boolean |
True if the node is accessibility focused. |
isCheckable
open fun isCheckable(): Boolean
Gets whether this node is checkable.
Return | |
---|---|
Boolean |
True if the node is checkable. |
isChecked
open funisChecked(): Boolean
Deprecated: Use getChecked()
instead.
Gets whether this node is checked. This is only meaningful when isCheckable()
returns true
.
Return | |
---|---|
Boolean |
True if the node is checked. |
isClickable
open fun isClickable(): Boolean
Gets whether this node is clickable.
Return | |
---|---|
Boolean |
True if the node is clickable. |
isContentInvalid
open fun isContentInvalid(): Boolean
Gets if the content of this node is invalid. For example, a date is not well-formed.
Return | |
---|---|
Boolean |
If the node content is invalid. |
isContextClickable
open fun isContextClickable(): Boolean
Gets whether this node is context clickable.
Return | |
---|---|
Boolean |
True if the node is context clickable. |
isDismissable
open fun isDismissable(): Boolean
Gets if the node can be dismissed.
Return | |
---|---|
Boolean |
If the node can be dismissed. |
isEditable
open fun isEditable(): Boolean
Gets if the node is editable.
Return | |
---|---|
Boolean |
True if the node is editable, false otherwise. |
isEnabled
open fun isEnabled(): Boolean
Gets whether this node is enabled.
Return | |
---|---|
Boolean |
True if the node is enabled. |
isFocusable
open fun isFocusable(): Boolean
Gets whether this node is focusable.
In the View system, this typically maps to View.isFocusable()
.
Return | |
---|---|
Boolean |
True if the node is focusable. |
isFocused
open fun isFocused(): Boolean
Gets whether this node is focused.
This is distinct from isAccessibilityFocused()
, which is used by screen readers. See AccessibilityAction.ACTION_ACCESSIBILITY_FOCUS
for details.
Return | |
---|---|
Boolean |
True if the node is focused. |
isGranularScrollingSupported
open fun isGranularScrollingSupported(): Boolean
Gets if the node supports granular scrolling.
Return | |
---|---|
Boolean |
True if all scroll actions that could support ACTION_ARGUMENT_SCROLL_AMOUNT_FLOAT have done so, false otherwise. |
isHeading
open fun isHeading(): Boolean
Returns whether node represents a heading.
Note: Returns true
if either setHeading(boolean)
marks this node as a heading or if the node has a CollectionItemInfo
that marks it as such, to accomodate apps that use the now-deprecated API.
Return | |
---|---|
Boolean |
true if the node is a heading, false otherwise. |
isImportantForAccessibility
open fun isImportantForAccessibility(): Boolean
Returns whether the node originates from a view considered important for accessibility.
Return | |
---|---|
Boolean |
true if the node originates from a view considered important for accessibility, false otherwise |
isLongClickable
open fun isLongClickable(): Boolean
Gets whether this node is long clickable.
Return | |
---|---|
Boolean |
True if the node is long clickable. |
isMultiLine
open fun isMultiLine(): Boolean
Gets if the node is a multi line editable text.
Return | |
---|---|
Boolean |
True if the node is multi line. |
isPassword
open fun isPassword(): Boolean
Gets whether this node is a password.
Return | |
---|---|
Boolean |
True if the node is a password. |
isScreenReaderFocusable
open fun isScreenReaderFocusable(): Boolean
Returns whether the node is explicitly marked as a focusable unit by a screen reader. Note that false
indicates that it is not explicitly marked, not that the node is not a focusable unit. Screen readers should generally use other signals, such as isFocusable()
, or the presence of text in a node, to determine what should receive focus.
Return | |
---|---|
Boolean |
true if the node is specifically marked as a focusable unit for screen readers, false otherwise. |
isScrollable
open fun isScrollable(): Boolean
Gets if the node is scrollable.
Return | |
---|---|
Boolean |
True if the node is scrollable, false otherwise. |
isSelected
open fun isSelected(): Boolean
Gets whether this node is selected.
Return | |
---|---|
Boolean |
True if the node is selected. |
isShowingHintText
open fun isShowingHintText(): Boolean
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.
Return | |
---|---|
Boolean |
true if the text in the node represents a hint to the user, false otherwise. |
isTextEntryKey
open fun isTextEntryKey(): Boolean
Returns whether node represents a text entry key that is part of a keyboard or keypad.
Return | |
---|---|
Boolean |
true if the node is a text entry key., false otherwise. |
isTextSelectable
open fun isTextSelectable(): Boolean
Gets if the node has selectable text.
Services should use ACTION_SET_SELECTION
for selection. Editable text nodes must also be selectable. But not all UIs will populate this field, so services should consider 'isTextSelectable | isEditable' to ensure they don't miss nodes with selectable text.
Return | |
---|---|
Boolean |
True if the node has selectable text. |
See Also
isVisibleToUser
open fun isVisibleToUser(): Boolean
Gets whether this node is visible to the user.
Between API 16
and API 29
, this method may incorrectly return false when magnification is enabled. On other versions, a node is considered visible even if it is not on the screen because magnification is active.
Return | |
---|---|
Boolean |
Whether the node is visible to the user. |
obtain
open static funobtain(): AccessibilityNodeInfo!
Deprecated: Object pooling has been discontinued. Create a new instance using the constructor AccessibilityNodeInfo()
instead.
Instantiates a new AccessibilityNodeInfo.
Return | |
---|---|
AccessibilityNodeInfo! |
An instance. |
obtain
open static funobtain(info: AccessibilityNodeInfo!): AccessibilityNodeInfo!
Deprecated: Object pooling has been discontinued. Create a new instance using the constructor AccessibilityNodeInfo(android.view.accessibility.AccessibilityNodeInfo)
instead.
Instantiates a new AccessibilityNodeInfo initialized from the given info
.
Parameters | |
---|---|
info |
AccessibilityNodeInfo!: The other info. |
Return | |
---|---|
AccessibilityNodeInfo! |
An instance. |
obtain
open static funobtain(source: View!): AccessibilityNodeInfo!
Deprecated: Object pooling has been discontinued. Create a new instance using the constructor AccessibilityNodeInfo(android.view.View)
instead.
Returns a cached instance if such is available otherwise a new one and sets the source.
Parameters | |
---|---|
source |
View!: The source view. |
Return | |
---|---|
AccessibilityNodeInfo! |
An instance. |
See Also
obtain
open static funobtain(
root: View!,
virtualDescendantId: Int
): AccessibilityNodeInfo!
Deprecated: Object pooling has been discontinued. Create a new instance using the constructor AccessibilityNodeInfo(android.view.View,int)
instead.
Returns a cached instance if such is available otherwise a new one and sets the source.
Parameters | |
---|---|
root |
View!: The root of the virtual subtree. |
virtualDescendantId |
Int: The id of the virtual descendant. |
Return | |
---|---|
AccessibilityNodeInfo! |
An instance. |
See Also
performAction
open fun performAction(action: Int): Boolean
Performs an action on the node.
Note: An action can be performed only if the request is made from an android.accessibilityservice.AccessibilityService
.
Parameters | |
---|---|
action |
Int: The action to perform. |
Return | |
---|---|
Boolean |
True if the action was performed. |
Exceptions | |
---|---|
java.lang.IllegalStateException |
If called outside of an AccessibilityService. |
performAction
open fun performAction(
action: Int,
arguments: Bundle!
): Boolean
Performs an action on the node.
Note: An action can be performed only if the request is made from an android.accessibilityservice.AccessibilityService
.
Parameters | |
---|---|
action |
Int: The action to perform. |
arguments |
Bundle!: A bundle with additional arguments. |
Return | |
---|---|
Boolean |
True if the action was performed. |
Exceptions | |
---|---|
java.lang.IllegalStateException |
If called outside of an AccessibilityService. |
recycle
open funrecycle(): Unit
Deprecated: Object pooling has been discontinued. Calling this function now will have no effect.
Would previously return an instance back to be reused.
refresh
open fun refresh(): Boolean
Refreshes this info with the latest state of the view it represents.
Return | |
---|---|
Boolean |
true if the refresh succeeded. false if the View represented by this node is no longer in the view tree (and thus this node is obsolete). |
refreshWithExtraData
open fun refreshWithExtraData(
extraDataKey: String!,
args: Bundle!
): Boolean
Refreshes this info with the latest state of the view it represents, and request new data be added by the View.
Parameters | |
---|---|
extraDataKey |
String!: The extra data requested. Data that must be requested with this mechanism is generally expensive to retrieve, so should only be requested when needed. See EXTRA_DATA_RENDERING_INFO_KEY , EXTRA_DATA_TEXT_CHARACTER_LOCATION_KEY , getAvailableExtraData() and getExtraRenderingInfo() . |
args |
Bundle!: A bundle of arguments for the request. These depend on the particular request. |
Return | |
---|---|
Boolean |
true if the refresh succeeded. false if the View represented by this node is no longer in the view tree (and thus this node is obsolete). |
removeAction
open fun removeAction(action: AccessibilityNodeInfo.AccessibilityAction!): Boolean
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 android.accessibilityservice.AccessibilityService
. This class is made immutable before being delivered to an AccessibilityService.
Parameters | |
---|---|
action |
AccessibilityNodeInfo.AccessibilityAction!: The action to be removed. |
Return | |
---|---|
Boolean |
The action removed from the list of actions. |
Exceptions | |
---|---|
java.lang.IllegalStateException |
If called from an AccessibilityService. |
removeAction
open funremoveAction(action: Int): Unit
Deprecated: 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 android.accessibilityservice.AccessibilityService
. This class is made immutable before being delivered to an AccessibilityService.
Parameters | |
---|---|
action |
Int: The action to be removed. |
Exceptions | |
---|---|
java.lang.IllegalStateException |
If called from an AccessibilityService. |
removeChild
open fun removeChild(child: View!): Boolean
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 android.accessibilityservice.AccessibilityService
. This class is made immutable before being delivered to an AccessibilityService.
Parameters | |
---|---|
child |
View!: The child. |
Return | |
---|---|
Boolean |
true if the child was present |
Exceptions | |
---|---|
java.lang.IllegalStateException |
If called from an AccessibilityService. |
removeChild
open fun removeChild(
root: View!,
virtualDescendantId: Int
): Boolean
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. |
Return | |
---|---|
Boolean |
true if the child was present |
See Also
removeLabeledBy
open fun removeLabeledBy(label: View): Boolean
Removes a label. If the label was not previously added to the node, calling this method has no effect.
Note: Cannot be called from an android.accessibilityservice.AccessibilityService
. This class is made immutable before being delivered to an AccessibilityService.
Parameters | |
---|---|
label |
View: The node which serves as this node's label. This value cannot be null . |
Return | |
---|---|
Boolean |
true if the label was present |
See Also
removeLabeledBy
open fun removeLabeledBy(
root: View,
virtualDescendantId: Int
): Boolean
Removes a label which is a virtual descendant of the given root
. If virtualDescendantId
is View.NO_ID
the root is set as the label. If the label was not previously added to the node, calling this method has no effect.
Parameters | |
---|---|
root |
View: The root of the virtual subtree. This value cannot be null . |
virtualDescendantId |
Int: The id of the virtual node which serves as this node's label. |
Return | |
---|---|
Boolean |
true if the label was present |
See Also
setAccessibilityDataSensitive
open fun setAccessibilityDataSensitive(accessibilityDataSensitive: Boolean): Unit
Sets whether this node's accessibility data is considered sensitive.
Note: Cannot be called from an AccessibilityService
. This class is made immutable before being delivered to an AccessibilityService.
Parameters | |
---|---|
accessibilityDataSensitive |
Boolean: True if the node's accessibility data is considered sensitive. |
Exceptions | |
---|---|
java.lang.IllegalStateException |
If called from an AccessibilityService. |
setAccessibilityFocused
open fun setAccessibilityFocused(focused: Boolean): Unit
Sets whether this node is accessibility focused.
Note: Cannot be called from an android.accessibilityservice.AccessibilityService
. This class is made immutable before being delivered to an AccessibilityService.
The UI element updating this property should send an event of AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUSED
or AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED
if its accessibility-focused state changes.
Parameters | |
---|---|
focused |
Boolean: True if the node is accessibility focused. |
Exceptions | |
---|---|
java.lang.IllegalStateException |
If called from an AccessibilityService. |
setAvailableExtraData
open fun setAvailableExtraData(extraDataKeys: MutableList<String!>!): Unit
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 android.accessibilityservice.AccessibilityService
. This class is made immutable before being delivered to an AccessibilityService.
Parameters | |
---|---|
extraDataKeys |
MutableList<String!>!: A list of types of extra data that are available. |
Exceptions | |
---|---|
java.lang.IllegalStateException |
If called from an AccessibilityService. |
See Also
setBoundsInParent
open funsetBoundsInParent(bounds: Rect!): Unit
Deprecated: Accessibility services should not care about these bounds.
Sets the node bounds in the viewParent's coordinates. getParent()
does not represent the source's viewParent. Instead it represents the result of View.getParentForAccessibility()
, which returns the closest ancestor where View.isImportantForAccessibility()
is true. So this method is not reliable.
Note: Cannot be called from an android.accessibilityservice.AccessibilityService
. This class is made immutable before being delivered to an AccessibilityService.
Parameters | |
---|---|
bounds |
Rect!: The node bounds. |
Exceptions | |
---|---|
java.lang.IllegalStateException |
If called from an AccessibilityService. |
setBoundsInScreen
open fun setBoundsInScreen(bounds: Rect!): Unit
Sets the node bounds in screen coordinates.
Note: Cannot be called from an android.accessibilityservice.AccessibilityService
. This class is made immutable before being delivered to an AccessibilityService.
Parameters | |
---|---|
bounds |
Rect!: The node bounds. |
Exceptions | |
---|---|
java.lang.IllegalStateException |
If called from an AccessibilityService. |
setBoundsInWindow
open fun setBoundsInWindow(bounds: Rect): Unit
Sets the node bounds in window coordinates.
Note: Cannot be called from an android.accessibilityservice.AccessibilityService
. This class is made immutable before being delivered to an AccessibilityService.
Parameters | |
---|---|
bounds |
Rect: The node bounds. This value cannot be null . |
Exceptions | |
---|---|
java.lang.IllegalStateException |
If called from an AccessibilityService. |
setCanOpenPopup
open fun setCanOpenPopup(opensPopup: Boolean): Unit
Sets if this node opens a popup or a dialog.
Note: Cannot be called from an android.accessibilityservice.AccessibilityService
. This class is made immutable before being delivered to an AccessibilityService.
Parameters | |
---|---|
opensPopup |
Boolean: If the the node opens a popup. |
setCheckable
open fun setCheckable(checkable: Boolean): Unit
Sets whether this node is checkable.
Note: Cannot be called from an android.accessibilityservice.AccessibilityService
. This class is made immutable before being delivered to an AccessibilityService.
Parameters | |
---|---|
checkable |
Boolean: True if the node is checkable. |
Exceptions | |
---|---|
java.lang.IllegalStateException |
If called from an AccessibilityService. |
setChecked
open funsetChecked(checked: Boolean): Unit
Deprecated: Use setChecked(int)
instead.
Sets whether this node is checked. This is only meaningful when isCheckable()
returns true
.
Note: Cannot be called from an android.accessibilityservice.AccessibilityService
. This class is made immutable before being delivered to an AccessibilityService.
Parameters | |
---|---|
checked |
Boolean: True if the node is checked. |
Exceptions | |
---|---|
java.lang.IllegalStateException |
If called from an AccessibilityService. |
setChecked
open fun setChecked(checked: Int): Unit
Sets the checked state of this node. This is only meaningful when isCheckable()
returns true
.
Note: Cannot be called from an android.accessibilityservice.AccessibilityService
. This class is made immutable before being delivered to an AccessibilityService.
Parameters | |
---|---|
checked |
Int: The checked state. One of
Value is android.view.accessibility.AccessibilityNodeInfo#CHECKED_STATE_FALSE , android.view.accessibility.AccessibilityNodeInfo#CHECKED_STATE_TRUE , or android.view.accessibility.AccessibilityNodeInfo#CHECKED_STATE_PARTIAL |
Exceptions | |
---|---|
java.lang.IllegalStateException |
If called from an AccessibilityService. |
java.lang.IllegalArgumentException |
if checked is not one of CHECKED_STATE_FALSE , CHECKED_STATE_TRUE , or CHECKED_STATE_PARTIAL . |
setClassName
open fun setClassName(className: CharSequence!): Unit
Sets the class this node comes from.
Note: Cannot be called from an android.accessibilityservice.AccessibilityService
. This class is made immutable before being delivered to an AccessibilityService.
Parameters | |
---|---|
className |
CharSequence!: The class name. |
Exceptions | |
---|---|
java.lang.IllegalStateException |
If called from an AccessibilityService. |
setClickable
open fun setClickable(clickable: Boolean): Unit
Sets whether this node is clickable.
Note: Cannot be called from an android.accessibilityservice.AccessibilityService
. This class is made immutable before being delivered to an AccessibilityService.
Parameters | |
---|---|
clickable |
Boolean: True if the node is clickable. |
Exceptions | |
---|---|
java.lang.IllegalStateException |
If called from an AccessibilityService. |
setCollectionInfo
open fun setCollectionInfo(collectionInfo: AccessibilityNodeInfo.CollectionInfo!): Unit
Sets the collection info if the node is a collection. A collection child is always a collection item.
Note: Cannot be called from an android.accessibilityservice.AccessibilityService
. This class is made immutable before being delivered to an AccessibilityService.
Parameters | |
---|---|
collectionInfo |
AccessibilityNodeInfo.CollectionInfo!: The collection info. |
setCollectionItemInfo
open fun setCollectionItemInfo(collectionItemInfo: AccessibilityNodeInfo.CollectionItemInfo!): Unit
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 android.accessibilityservice.AccessibilityService
. This class is made immutable before being delivered to an AccessibilityService.
setContainerTitle
open fun setContainerTitle(containerTitle: CharSequence?): Unit
Sets the container title for app-developer-defined container which can be any type of ViewGroup or layout. Container title will be used to group together related controls, similar to HTML fieldset. Or container title may identify a large piece of the UI that is visibly grouped together, such as a toolbar or a card, etc.
Container title helps to assist in navigation across containers and other groups. For example, a screen reader may use this to determine where to put accessibility focus.
Container title is different from pane titlesetPaneTitle
which indicates that the node represents a window or activity.
Example: An app can set container titles on several non-modal menus, containing TextViews or ImageButtons that have content descriptions, text, etc. Screen readers can quickly switch accessibility focus among menus instead of child views. Other accessibility-services can easily find the menu.
Parameters | |
---|---|
containerTitle |
CharSequence?: The container title that is associated with a ViewGroup/Layout on the screen. This value may be null . |
setContentDescription
open fun setContentDescription(contentDescription: CharSequence!): Unit
Sets the content description of this node.
Note: Cannot be called from an android.accessibilityservice.AccessibilityService
. This class is made immutable before being delivered to an AccessibilityService.
Parameters | |
---|---|
contentDescription |
CharSequence!: The content description. |
Exceptions | |
---|---|
java.lang.IllegalStateException |
If called from an AccessibilityService. |
setContentInvalid
open fun setContentInvalid(contentInvalid: Boolean): Unit
Sets if the content of this node is invalid. For example, a date is not well-formed.
Note: Cannot be called from an android.accessibilityservice.AccessibilityService
. This class is made immutable before being delivered to an AccessibilityService.
Parameters | |
---|---|
contentInvalid |
Boolean: If the node content is invalid. |
setContextClickable
open fun setContextClickable(contextClickable: Boolean): Unit
Sets whether this node is context clickable.
Note: Cannot be called from an android.accessibilityservice.AccessibilityService
. This class is made immutable before being delivered to an AccessibilityService.
Parameters | |
---|---|
contextClickable |
Boolean: True if the node is context clickable. |
Exceptions | |
---|---|
java.lang.IllegalStateException |
If called from an AccessibilityService. |
setDismissable
open fun setDismissable(dismissable: Boolean): Unit
Sets if the node can be dismissed.
Note: Cannot be called from an android.accessibilityservice.AccessibilityService
. This class is made immutable before being delivered to an AccessibilityService.
Parameters | |
---|---|
dismissable |
Boolean: If the node can be dismissed. |
setDrawingOrder
open fun setDrawingOrder(drawingOrderInParent: Int): Unit
Set the drawing order of the view corresponding it this node.
Note: Cannot be called from an android.accessibilityservice.AccessibilityService
. This class is made immutable before being delivered to an AccessibilityService.
Parameters | |
---|---|
drawingOrderInParent |
Int: |
Exceptions | |
---|---|
java.lang.IllegalStateException |
If called from an AccessibilityService. |
setEditable
open fun setEditable(editable: Boolean): Unit
Sets whether this node is editable.
Note: Cannot be called from an android.accessibilityservice.AccessibilityService
. This class is made immutable before being delivered to an AccessibilityService.
Parameters | |
---|---|
editable |
Boolean: True if the node is editable. |
Exceptions | |
---|---|
java.lang.IllegalStateException |
If called from an AccessibilityService. |
setEnabled
open fun setEnabled(enabled: Boolean): Unit
Sets whether this node is enabled.
Note: Cannot be called from an android.accessibilityservice.AccessibilityService
. This class is made immutable before being delivered to an AccessibilityService.
Parameters | |
---|---|
enabled |
Boolean: True if the node is enabled. |
Exceptions | |
---|---|
java.lang.IllegalStateException |
If called from an AccessibilityService. |
setError
open fun setError(error: CharSequence!): Unit
Sets the error text of this node.
Note: Cannot be called from an android.accessibilityservice.AccessibilityService
. This class is made immutable before being delivered to an AccessibilityService.
Parameters | |
---|---|
error |
CharSequence!: The error text. |
Exceptions | |
---|---|
java.lang.IllegalStateException |
If called from an AccessibilityService. |
setExpandedState
open fun setExpandedState(state: Int): Unit
Sets the expanded state of the node.
Note: Cannot be called from an . This class is made immutable before being delivered to an android.accessibilityservice.AccessibilityService
.
Exceptions | |
---|---|
java.lang.IllegalArgumentException |
If state is not one of: |
java.lang.IllegalStateException |
If called from an AccessibilityService |
setFocusable
open fun setFocusable(focusable: Boolean): Unit
Sets whether this node is focusable.
Note: Cannot be called from an android.accessibilityservice.AccessibilityService
. This class is made immutable before being delivered to an AccessibilityService.
To mark a node as explicitly focusable for a screen reader, consider using setScreenReaderFocusable(boolean)
instead.
Parameters | |
---|---|
focusable |
Boolean: True if the node is focusable. |
Exceptions | |
---|---|
java.lang.IllegalStateException |
If called from an AccessibilityService. |
setFocused
open fun setFocused(focused: Boolean): Unit
Sets whether this node is focused.
Note: Cannot be called from an android.accessibilityservice.AccessibilityService
. This class is made immutable before being delivered to an AccessibilityService.
Parameters | |
---|---|
focused |
Boolean: True if the node is focused. |
Exceptions | |
---|---|
java.lang.IllegalStateException |
If called from an AccessibilityService. |
setGranularScrollingSupported
open fun setGranularScrollingSupported(granularScrollingSupported: Boolean): Unit
Sets if the node supports granular scrolling. This should be set to true if all scroll actions which could support ACTION_ARGUMENT_SCROLL_AMOUNT_FLOAT
have done so.
Note: Cannot be called from an android.accessibilityservice.AccessibilityService
. This class is made immutable before being delivered to an AccessibilityService.
Parameters | |
---|---|
granularScrollingSupported |
Boolean: True if the node supports granular scrolling, false otherwise. |
Exceptions | |
---|---|
java.lang.IllegalStateException |
If called from an AccessibilityService. |
setHeading
open fun setHeading(isHeading: Boolean): Unit
Sets whether the node represents a heading.
Note: Cannot be called from an android.accessibilityservice.AccessibilityService
. This class is made immutable before being delivered to an AccessibilityService.
Parameters | |
---|---|
isHeading |
Boolean: true if the node is a heading, false otherwise. |
setHintText
open fun setHintText(hintText: CharSequence!): Unit
Sets the hint text of this node. Only applies to nodes where text can be entered.
Note: Cannot be called from an android.accessibilityservice.AccessibilityService
. This class is made immutable before being delivered to an AccessibilityService.
Parameters | |
---|---|
hintText |
CharSequence!: The hint text for this mode. |
Exceptions | |
---|---|
java.lang.IllegalStateException |
If called from an AccessibilityService. |
setImportantForAccessibility
open fun setImportantForAccessibility(important: Boolean): Unit
Sets whether the node is considered important for accessibility.
Note: Cannot be called from an android.accessibilityservice.AccessibilityService
. This class is made immutable before being delivered to an AccessibilityService.
Parameters | |
---|---|
important |
Boolean: true if the node is considered important for accessibility, false otherwise |
setInputType
open fun setInputType(inputType: Int): Unit
Sets the input type of the source as defined by InputType
.
Note: Cannot be called from an android.accessibilityservice.AccessibilityService
. This class is made immutable before being delivered to an AccessibilityService.
Parameters | |
---|---|
inputType |
Int: The input type. |
Exceptions | |
---|---|
java.lang.IllegalStateException |
If called from an AccessibilityService. |
setLabelFor
open fun setLabelFor(labeled: View!): Unit
Sets the view for which the view represented by this info serves as a label for accessibility purposes.
Parameters | |
---|---|
labeled |
View!: The view for which this info serves as a label. |
setLabelFor
open fun setLabelFor(
root: View!,
virtualDescendantId: Int
): Unit
Sets the view for which the view represented by this info serves as a label for accessibility purposes. If virtualDescendantId
is View.NO_ID
the root is set as the labeled.
A virtual descendant is an imaginary View that is reported as a part of the view hierarchy for accessibility purposes. This enables custom views that draw complex content to report themselves as a tree of virtual views, thus conveying their logical structure.
Note: Cannot be called from an android.accessibilityservice.AccessibilityService
. This class is made immutable before being delivered to an AccessibilityService.
Parameters | |
---|---|
root |
View!: The root whose virtual descendant serves as a label. |
virtualDescendantId |
Int: The id of the virtual descendant. |
setLabeledBy
open funsetLabeledBy(label: View!): Unit
Deprecated: Use addLabeledBy(android.view.View)
or removeLabeledBy(android.view.View)
instead.
Sets the view which serves as the label of the view represented by this info for accessibility purposes.
Parameters | |
---|---|
label |
View!: The view that labels this node's source. |
setLabeledBy
open funsetLabeledBy(
root: View!,
virtualDescendantId: Int
): Unit
Deprecated: Use addLabeledBy(android.view.View,int)
or removeLabeledBy(android.view.View,int)
instead.
Sets the view which serves as the label of the view represented by this info for accessibility purposes. If virtualDescendantId
is View.NO_ID
the root is set as the label.
A virtual descendant is an imaginary View that is reported as a part of the view hierarchy for accessibility purposes. This enables custom views that draw complex content to report themselves as a tree of virtual views, thus conveying their logical structure.
Note: Cannot be called from an android.accessibilityservice.AccessibilityService
. This class is made immutable before being delivered to an AccessibilityService.
Parameters | |
---|---|
root |
View!: The root whose virtual descendant labels this node's source. |
virtualDescendantId |
Int: The id of the virtual descendant. |
setLiveRegion
open fun setLiveRegion(mode: Int): Unit
Sets the node's live region mode.
Note: Cannot be called from an android.accessibilityservice.AccessibilityService
. This class is made immutable before being delivered to an AccessibilityService.
Parameters | |
---|---|
mode |
Int: The live region mode, or View.ACCESSIBILITY_LIVE_REGION_NONE if the view is not a live region. |
setLongClickable
open fun setLongClickable(longClickable: Boolean): Unit
Sets whether this node is long clickable.
Note: Cannot be called from an android.accessibilityservice.AccessibilityService
. This class is made immutable before being delivered to an AccessibilityService.
Parameters | |
---|---|
longClickable |
Boolean: True if the node is long clickable. |
Exceptions | |
---|---|
java.lang.IllegalStateException |
If called from an AccessibilityService. |
setMaxTextLength
open fun setMaxTextLength(max: Int): Unit
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 android.accessibilityservice.AccessibilityService
. This class is made immutable before being delivered to an AccessibilityService.
Parameters | |
---|---|
max |
Int: The maximum text length. |
Exceptions | |
---|---|
java.lang.IllegalStateException |
If called from an AccessibilityService. |
See Also
setMinDurationBetweenContentChanges
open fun setMinDurationBetweenContentChanges(duration: Duration): Unit
Sets the minimum time duration between two content change events, which is used in throttling content change events in accessibility services.
Example: An app can set MinMillisBetweenContentChanges as 1 min for a view which sends content change events to accessibility services one event per second. Accessibility service will throttle those content change events and only handle one event per minute for that view.
Example UI elements that frequently update and may benefit from a duration are progress bars, timers, and stopwatches.
Parameters | |
---|---|
duration |
Duration: the minimum duration between content change events. Negative duration would be treated as zero. This value cannot be null . |
setMovementGranularities
open fun setMovementGranularities(granularities: Int): Unit
Sets the movement granularities for traversing the text of this node.
Note: Cannot be called from an android.accessibilityservice.AccessibilityService
. This class is made immutable before being delivered to an AccessibilityService.
Parameters | |
---|---|
granularities |
Int: The bit mask with granularities. |
Exceptions | |
---|---|
java.lang.IllegalStateException |
If called from an AccessibilityService. |
setMultiLine
open fun setMultiLine(multiLine: Boolean): Unit
Sets if the node is a multi line editable text.
Note: Cannot be called from an android.accessibilityservice.AccessibilityService
. This class is made immutable before being delivered to an AccessibilityService.
Parameters | |
---|---|
multiLine |
Boolean: True if the node is multi line. |
setPackageName
open fun setPackageName(packageName: CharSequence!): Unit
Sets the package this node comes from.
Note: Cannot be called from an android.accessibilityservice.AccessibilityService
. This class is made immutable before being delivered to an AccessibilityService.
Parameters | |
---|---|
packageName |
CharSequence!: The package name. |
Exceptions | |
---|---|
java.lang.IllegalStateException |
If called from an AccessibilityService. |
setPaneTitle
open fun setPaneTitle(paneTitle: CharSequence?): Unit
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 android.accessibilityservice.AccessibilityService
. This class is made immutable before being delivered to an AccessibilityService.
Parameters | |
---|---|
paneTitle |
CharSequence?: The title of the pane represented by this node. This value may be null . |
setParent
open fun setParent(parent: View!): Unit
Sets the parent.
Note: Cannot be called from an android.accessibilityservice.AccessibilityService
. This class is made immutable before being delivered to an AccessibilityService.
Parameters | |
---|---|
parent |
View!: The parent. |
Exceptions | |
---|---|
java.lang.IllegalStateException |
If called from an AccessibilityService. |
setParent
open fun setParent(
root: View!,
virtualDescendantId: Int
): Unit
Sets the parent to be a virtual descendant of the given root
. If virtualDescendantId
equals to View.NO_ID
the root is set as the parent.
A virtual descendant is an imaginary View that is reported as a part of the view hierarchy for accessibility purposes. This enables custom views that draw complex content to report them selves as a tree of virtual views, thus conveying their logical structure.
Note: Cannot be called from an android.accessibilityservice.AccessibilityService
. This class is made immutable before being delivered to an AccessibilityService.
Parameters | |
---|---|
root |
View!: The root of the virtual subtree. |
virtualDescendantId |
Int: The id of the virtual descendant. |
setPassword
open fun setPassword(password: Boolean): Unit
Sets whether this node is a password.
Note: Cannot be called from an android.accessibilityservice.AccessibilityService
. This class is made immutable before being delivered to an AccessibilityService.
Parameters | |
---|---|
password |
Boolean: True if the node is a password. |
Exceptions | |
---|---|
java.lang.IllegalStateException |
If called from an AccessibilityService. |
setQueryFromAppProcessEnabled
open fun setQueryFromAppProcessEnabled(
view: View,
enabled: Boolean
): Unit
Connects this node to the View's root so that operations on this node can query the entire AccessibilityNodeInfo
tree and perform accessibility actions on nodes.
Testing or debugging tools should create this AccessibilityNodeInfo
node using View.createAccessibilityNodeInfo()
or AccessibilityNodeProvider
and call this method, then navigate and interact with the node tree by calling methods on the node. Calling this method more than once on the same node is a no-op. After calling this method, all nodes linked to this node (children, ancestors, etc.) are also queryable.
Here "query" refers to the following node operations:
isScrollable()
)getChild(int)
)getParent()
)findFocus(int)
, focusSearch(int)
)findAccessibilityNodeInfosByText(java.lang.String)
, findAccessibilityNodeInfosByViewId(java.lang.String)
)performAction(int)
) This is intended for short-lived inspections from testing or debugging tools in the app process, as operations on this node tree will only succeed as long as the associated view hierarchy remains attached to a window. AccessibilityNodeInfo
objects can quickly become out of sync with their corresponding View
objects; if you wish to inspect a changed or different view hierarchy then create a new node from any view in that hierarchy and call this method on that new node, instead of disabling & re-enabling the connection on the previous node.
Parameters | |
---|---|
view |
View: The view that generated this node, or any view in the same view-root hierarchy. This value cannot be null . |
enabled |
Boolean: Whether to enable (true) or disable (false) querying from the app process. |
Exceptions | |
---|---|
java.lang.IllegalStateException |
If called from an AccessibilityService , or if provided a View that is not attached to a window. |
setRangeInfo
open fun setRangeInfo(rangeInfo: AccessibilityNodeInfo.RangeInfo!): Unit
Sets the range info if this node is a range.
Note: Cannot be called from an android.accessibilityservice.AccessibilityService
. This class is made immutable before being delivered to an AccessibilityService.
Parameters | |
---|---|
rangeInfo |
AccessibilityNodeInfo.RangeInfo!: The range info. |
setRequestInitialAccessibilityFocus
open fun setRequestInitialAccessibilityFocus(requestInitialAccessibilityFocus: Boolean): Unit
Sets whether the node has requested initial accessibility focus.
If the node hasRequestInitialAccessibilityFocus
, this node would be one of candidates to be accessibility focused when the window appears.
Note: Cannot be called from an android.accessibilityservice.AccessibilityService
. This class is made immutable before being delivered to an AccessibilityService.
Parameters | |
---|---|
requestInitialAccessibilityFocus |
Boolean: True if the node requests to receive initial accessibility focus. |
Exceptions | |
---|---|
java.lang.IllegalStateException |
If called from an AccessibilityService. |
setScreenReaderFocusable
open fun setScreenReaderFocusable(screenReaderFocusable: Boolean): Unit
Sets whether the node should be considered a focusable unit by a screen reader.
Note: Cannot be called from an android.accessibilityservice.AccessibilityService
. This class is made immutable before being delivered to an AccessibilityService.
This can be used to group related content.
Parameters | |
---|---|
screenReaderFocusable |
Boolean: true if the node is a focusable unit for screen readers, false otherwise. |
setScrollable
open fun setScrollable(scrollable: Boolean): Unit
Sets if the node is scrollable.
Note: Cannot be called from an android.accessibilityservice.AccessibilityService
. This class is made immutable before being delivered to an AccessibilityService.
Parameters | |
---|---|
scrollable |
Boolean: True if the node is scrollable, false otherwise. |
Exceptions | |
---|---|
java.lang.IllegalStateException |
If called from an AccessibilityService. |
setSelected
open fun setSelected(selected: Boolean): Unit
Sets whether this node is selected.
Note: Cannot be called from an android.accessibilityservice.AccessibilityService
. This class is made immutable before being delivered to an AccessibilityService.
Parameters | |
---|---|
selected |
Boolean: True if the node is selected. |
Exceptions | |
---|---|
java.lang.IllegalStateException |
If called from an AccessibilityService. |
setShowingHintText
open fun setShowingHintText(showingHintText: Boolean): Unit
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 android.accessibilityservice.AccessibilityService
. This class is made immutable before being delivered to an AccessibilityService.
Parameters | |
---|---|
showingHintText |
Boolean: true if the text in the node represents a hint to the user, false otherwise. |
setSource
open fun setSource(source: View!): Unit
Sets the source.
Note: Cannot be called from an android.accessibilityservice.AccessibilityService
. This class is made immutable before being delivered to an AccessibilityService.
Parameters | |
---|---|
source |
View!: The info source. |
setSource
open fun setSource(
root: View!,
virtualDescendantId: Int
): Unit
Sets the source to be a virtual descendant of the given root
. If virtualDescendantId
is View.NO_ID
the root is set as the source.
A virtual descendant is an imaginary View that is reported as a part of the view hierarchy for accessibility purposes. This enables custom views that draw complex content to report themselves as a tree of virtual views, thus conveying their logical structure.
Note: Cannot be called from an android.accessibilityservice.AccessibilityService
. This class is made immutable before being delivered to an AccessibilityService.
Parameters | |
---|---|
root |
View!: The root of the virtual subtree. |
virtualDescendantId |
Int: The id of the virtual descendant. |
setStateDescription
open fun setStateDescription(stateDescription: CharSequence?): Unit
Sets the state description of this node.
Note: Cannot be called from an android.accessibilityservice.AccessibilityService
. This class is made immutable before being delivered to an AccessibilityService.
Parameters | |
---|---|
stateDescription |
CharSequence?: the state description of this node. This value may be null . |
Exceptions | |
---|---|
java.lang.IllegalStateException |
If called from an AccessibilityService. |
setText
open fun setText(text: CharSequence!): Unit
Sets the text of this node.
Note: Cannot be called from an android.accessibilityservice.AccessibilityService
. This class is made immutable before being delivered to an AccessibilityService.
Parameters | |
---|---|
text |
CharSequence!: The text. |
Exceptions | |
---|---|
java.lang.IllegalStateException |
If called from an AccessibilityService. |
setTextEntryKey
open fun setTextEntryKey(isTextEntryKey: Boolean): Unit
Sets whether the node represents a text entry key that is part of a keyboard or keypad.
Note: Cannot be called from an android.accessibilityservice.AccessibilityService
. This class is made immutable before being delivered to an AccessibilityService.
Parameters | |
---|---|
isTextEntryKey |
Boolean: true if the node is a text entry key, false otherwise. |
setTextSelectable
open fun setTextSelectable(selectableText: Boolean): Unit
Sets if the node has selectable text.
Note: Cannot be called from an android.accessibilityservice.AccessibilityService
. This class is made immutable before being delivered to an AccessibilityService.
Parameters | |
---|---|
selectableText |
Boolean: True if the node has selectable text, false otherwise. |
Exceptions | |
---|---|
java.lang.IllegalStateException |
If called from an AccessibilityService. |
setTextSelection
open fun setTextSelection(
start: Int,
end: Int
): Unit
Sets the text selection start and end.
Note: Cannot be called from an android.accessibilityservice.AccessibilityService
. This class is made immutable before being delivered to an AccessibilityService.
Parameters | |
---|---|
start |
Int: The text selection start. |
end |
Int: The text selection end. |
Exceptions | |
---|---|
java.lang.IllegalStateException |
If called from an AccessibilityService. |
setTooltipText
open fun setTooltipText(tooltipText: CharSequence?): Unit
Sets the tooltip text of this node.
Note: Cannot be called from an android.accessibilityservice.AccessibilityService
. This class is made immutable before being delivered to an AccessibilityService.
Parameters | |
---|---|
tooltipText |
CharSequence?: The tooltip text. This value may be null . |
Exceptions | |
---|---|
java.lang.IllegalStateException |
If called from an AccessibilityService. |
setTouchDelegateInfo
open fun setTouchDelegateInfo(delegatedInfo: AccessibilityNodeInfo.TouchDelegateInfo): Unit
Set touch delegate info if the represented view has a TouchDelegate
.
Note: Cannot be called from an android.accessibilityservice.AccessibilityService
. This class is made immutable before being delivered to an AccessibilityService.
Parameters | |
---|---|
delegatedInfo |
AccessibilityNodeInfo.TouchDelegateInfo: TouchDelegateInfo returned from TouchDelegate.getTouchDelegateInfo() . This value cannot be null . |
Exceptions | |
---|---|
java.lang.IllegalStateException |
If called from an AccessibilityService. |
setTraversalAfter
open fun setTraversalAfter(view: View!): Unit
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 android.accessibilityservice.AccessibilityService
. This class is made immutable before being delivered to an AccessibilityService.
Parameters | |
---|---|
view |
View!: The previous view. |
See Also
setTraversalAfter
open fun setTraversalAfter(
root: View!,
virtualDescendantId: Int
): Unit
Sets the node after which this one is visited in accessibility traversal. A screen-reader must visit the content of the other node before the content of this one. If virtualDescendantId
equals to View.NO_ID
the root is set as the predecessor.
A virtual descendant is an imaginary View that is reported as a part of the view hierarchy for accessibility purposes. This enables custom views that draw complex content to report them selves as a tree of virtual views, thus conveying their logical structure.
Note: Cannot be called from an android.accessibilityservice.AccessibilityService
. This class is made immutable before being delivered to an AccessibilityService.
Parameters | |
---|---|
root |
View!: The root of the virtual subtree. |
virtualDescendantId |
Int: The id of the virtual descendant. |
setTraversalBefore
open fun setTraversalBefore(view: View!): Unit
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 android.accessibilityservice.AccessibilityService
. This class is made immutable before being delivered to an AccessibilityService.
Parameters | |
---|---|
view |
View!: The view providing the preceding node. |
See Also
setTraversalBefore
open fun setTraversalBefore(
root: View!,
virtualDescendantId: Int
): Unit
Sets the node before which this one is visited during traversal. A screen-reader must visit the content of this node before the content of the one it precedes. The successor is a virtual descendant of the given root
. If virtualDescendantId
equals to View.NO_ID
the root is set as the successor.
A virtual descendant is an imaginary View that is reported as a part of the view hierarchy for accessibility purposes. This enables custom views that draw complex content to report them selves as a tree of virtual views, thus conveying their logical structure.
Note: Cannot be called from an android.accessibilityservice.AccessibilityService
. This class is made immutable before being delivered to an AccessibilityService.
Parameters | |
---|---|
root |
View!: The root of the virtual subtree. |
virtualDescendantId |
Int: The id of the virtual descendant. |
setUniqueId
open fun setUniqueId(uniqueId: String?): Unit
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
open fun setViewIdResourceName(viewIdResName: String!): Unit
Sets the fully qualified resource name of the source view's id.
Note: Cannot be called from an android.accessibilityservice.AccessibilityService
. This class is made immutable before being delivered to an AccessibilityService.
Parameters | |
---|---|
viewIdResName |
String!: The id resource name. |
setVisibleToUser
open fun setVisibleToUser(visibleToUser: Boolean): Unit
Sets whether this node is visible to the user.
Note: Cannot be called from an android.accessibilityservice.AccessibilityService
. This class is made immutable before being delivered to an AccessibilityService.
Parameters | |
---|---|
visibleToUser |
Boolean: Whether the node is visible to the user. |
Exceptions | |
---|---|
java.lang.IllegalStateException |
If called from an AccessibilityService. |
toString
open fun toString(): String
Return | |
---|---|
String |
a string representation of the object. |
writeToParcel
open fun writeToParcel(
parcel: Parcel,
flags: Int
): Unit
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 | |
---|---|
dest |
The Parcel in which the object should be written. This value cannot be null . |
flags |
Int: Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE . Value is either 0 or a combination of android.os.Parcelable#PARCELABLE_WRITE_RETURN_VALUE , and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES |
Properties
CREATOR
static val CREATOR: Parcelable.Creator<AccessibilityNodeInfo!>
See Also