Save the date! Android Dev Summit is coming to Sunnyvale, CA on Oct 23-24, 2019.

AccessibilityNodeInfoCompat

open class AccessibilityNodeInfoCompat
kotlin.Any
   ↳ androidx.core.view.accessibility.AccessibilityNodeInfoCompat

Helper for accessing android.view.accessibility.AccessibilityNodeInfo in a backwards compatible fashion.

Summary

Nested classes
open

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

open

Class with information if a node is a collection.

open

Class with information if a node is a collection item.

open

Class with information if a node is a range.

Constants
static Int

Action that focuses the node.

static Int

Action that unfocuses the node.

static Int

Action that selects the node.

static Int

Action that unselects the node.

static Int

Action that clicks on the node info.

static Int

Action that long clicks on the node.

static Int

Action that gives accessibility focus to the node.

static Int

Action that clears accessibility focus of 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 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 next HTML element of a given type.

static Int

Action to move to the previous HTML element of a given type.

static Int

Action to scroll the node content forward.

static Int

Action to scroll the node content backward.

static Int

Action to copy the current selection to the clipboard.

static Int

Action to paste the current clipboard content.

static Int

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

static Int

Action to set the selection.

static Int

Action to expand an expandable node.

static Int

Action to collapse an expandable node.

static Int

Action to dismiss a dismissable node.

static Int

Action that sets the text of the node.

static String

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

static String

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

static String

Argument for whether when moving at granularity to extend the selection or to move it otherwise.

static String

Argument for specifying the selection start.

static String

Argument for specifying the selection end.

static String

Argument for specifying the text content to set

static String

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

static String

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

static String

Argument for specifying the progress value to set.

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 Int

The input focus.

static Int

The accessibility focus.

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

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

static Int

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

Public constructors
<init>(info: Any!)

Use wrap(AccessibilityNodeInfo) instead.

Public methods
open Unit

Sets the fully qualified resource name of the source view's id.

open Int

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

open Int

Gets the node's live region mode.

open CharSequence!

Gets the error text of this node.

open Boolean

Returns whether the node is explicitly marked as a focusable unit by a screen reader.

open Unit

Sets the node bounds in screen coordinates.

open Unit
setDismissable(dismissable: Boolean)

Sets if the node can be dismissed.

open Boolean

Gets if the node is editable.

open Int

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

open Unit
getBoundsInParent(outBounds: Rect!)

Gets the node bounds in parent coordinates.

open CharSequence?

Gets the tooltip text of this node.

open Unit

Sets the maximum text length, or -1 for no limit.

open Int

Gets the number of children.

open Unit

Sets the node's live region mode.

open Unit
setEnabled(enabled: Boolean)

Sets whether this node is enabled.

open Boolean

Gets whether this node is clickable.

open Unit

Sets whether this node is accessibility focused.

open Unit
setMultiLine(multiLine: Boolean)

Sets if the node is a multi line editable text.

open CharSequence?

Get the title of the pane represented by this node.

open Boolean

Refreshes this info with the latest state of the view it represents.

open Unit
setScrollable(scrollable: Boolean)

Sets if the node is scrollable.

open AccessibilityNodeInfoCompat.RangeInfoCompat!

Gets the range info if this node is a range.

open Unit
setContentInvalid(contentInvalid: Boolean)

Sets if the content of this node is invalid.

open Int

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

open Unit
setParent(parent: View!)

Sets the parent.

open Unit
setParent(root: View!, virtualDescendantId: Int)

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

open Unit

Sets the class this node comes from.

open Unit
setLongClickable(longClickable: Boolean)

Sets whether this node is long clickable.

open Unit

Sets the range info if this node is a range.

open Unit
setInputType(inputType: Int)

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

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

open Unit

Return an instance back to be reused.

open AccessibilityNodeInfoCompat!
focusSearch(direction: Int)

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

open Boolean

Gets whether this node is checkable.

open CharSequence?

Gets the hint text of this node.

open Unit

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
setSource(source: View!)

Sets the source.

open Unit
setSource(root: View!, virtualDescendantId: Int)

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

open Boolean

Gets whether this node is visible to the user.

open Boolean

Gets whether this node is long clickable.

open Int

Gets the actions that can be performed on the node.

open AccessibilityNodeInfoCompat!

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

open Unit
setEditable(editable: Boolean)

Sets whether this node is editable.

open Boolean

Gets if the node is a multi line editable text.

open Unit
setClickable(clickable: Boolean)

Sets whether this node is clickable.

open AccessibilityNodeInfoCompat!

Gets the node before which this one is visited during traversal.

open AccessibilityNodeInfo!

open Unit
setTooltipText(@Nullable tooltipText: CharSequence?)

Sets the tooltip text of this node.

open Boolean

Gets whether this node is selected.

open Unit
setCollectionItemInfo(collectionItemInfo: Any!)

open Boolean

Gets whether this node is a password.

open Unit
setPaneTitle(@Nullable 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 Int

Get the drawing order of the view corresponding it this node.

open MutableList<AccessibilityNodeInfoCompat!>!

Finds android.view.accessibility.AccessibilityNodeInfos by text.

open Boolean

Returns whether the node originates from a view considered important for accessibility.

open Unit
setFocused(focused: Boolean)

Sets whether this node is focused.

open Int

Gets the text selection start.

open Boolean

Removes an action that can be performed on the node.

open Boolean
equals(other: Any?)

open Unit
setCollectionInfo(collectionInfo: Any!)

open Boolean

Gets whether this node is focused.

open Unit
setHintText(@Nullable hintText: CharSequence?)

Sets the hint text of this node.

open Unit
setCheckable(checkable: Boolean)

Sets whether this node is checkable.

open Unit
setFocusable(focusable: Boolean)

Sets whether this node is focusable.

open Boolean

Gets whether this node is context clickable.

open Unit
addChild(child: View!)

Adds a child.

open Unit
addChild(root: View!, virtualDescendantId: Int)

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

open MutableList<AccessibilityNodeInfoCompat.AccessibilityActionCompat!>!

Gets the actions that can be performed on the node.

open Unit
setMovementGranularities(granularities: Int)

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

open AccessibilityNodeInfoCompat.CollectionInfoCompat!

Gets the collection info if the node is a collection.

open AccessibilityNodeInfoCompat!
findFocus(focus: Int)

Find the view that has the specified focus type.

open Boolean

Gets if the node is scrollable.

open CharSequence!

Gets the content description of this node.

open CharSequence!

Gets the text of this node.

open Unit

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

Sets the text of this node.

open Boolean

Gets if the content of this node is invalid.

open Unit
setChecked(checked: Boolean)

Sets whether this node is checked.

open AccessibilityNodeInfoCompat!

Gets the node info 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
setContextClickable(contextClickable: Boolean)

Sets whether this node is context clickable.

open Boolean

Gets if the node can be dismissed.

open Unit
getBoundsInScreen(outBounds: Rect!)

Gets the node bounds in screen coordinates.

open Int

open Unit

Sets the node bounds in parent coordinates.

open String

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 AccessibilityNodeInfoCompat!
getChild(index: Int)

Get the child at given index.

open Boolean

Returns whether the node's text represents a hint for the user to enter text.

open Boolean

Gets whether this node is enabled.

open Unit

Sets whether the node is considered important for accessibility.

open Boolean

Gets whether this node is focusable.

open Boolean

Returns whether node represents a heading.

open CharSequence!

Gets the package this node comes from.

open Any!

open Unit
setCanOpenPopup(opensPopup: Boolean)

Sets if this node opens a popup or a dialog.

open Unit
setVisibleToUser(visibleToUser: Boolean)

Sets whether this node is visible to the user.

open Bundle!

Gets an optional bundle with extra data.

open CharSequence!

Gets the class this node comes from.

open Unit
setTextSelection(start: Int, end: Int)

Sets the text selection start and end.

open AccessibilityNodeInfoCompat!

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

open Boolean

Gets whether this node is checked.

open Boolean

Gets whether this node is accessibility focused.

open String!

Gets the fully qualified resource name of the source view's id.

open Int

Gets the text selection end.

open Unit

Sets the package this node comes from.

open Unit
addAction(action: Int)

Adds an action that can be performed on the node.

open Unit

Adds an action that can be performed on the node.

open Unit
setHeading(isHeading: Boolean)

Sets whether the node represents a heading.

open Unit

Sets the error text of this node.

open Int

Returns the maximum text length for this node.

open Boolean

Gets if this node opens a popup or a dialog.

open Unit
setScreenReaderFocusable(screenReaderFocusable: Boolean)

Sets whether the node should be considered a focusable unit by a screen reader.

open AccessibilityNodeInfoCompat.CollectionItemInfoCompat!

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

open Unit
setShowingHintText(showingHintText: Boolean)

Sets whether the node's text represents a hint for the user to enter text.

open AccessibilityNodeInfoCompat!

Gets the parent.

open AccessibilityWindowInfoCompat!

Gets the window to which this node belongs.

open MutableList<AccessibilityNodeInfoCompat!>!

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

open Unit
setContentDescription(contentDescription: CharSequence!)

Sets the content description of this node.

open CharSequence?

Gets the custom role description.

open Unit
setRoleDescription(@Nullable roleDescription: CharSequence?)

Sets the custom role description.

open Unit
setDrawingOrder(drawingOrderInParent: Int)

Set the drawing order of the view corresponding it this node.

open Unit
setPassword(password: Boolean)

Sets whether this node is a password.

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
setSelected(selected: Boolean)

Sets whether this node is selected.

open static AccessibilityNodeInfoCompat!
wrap(@NonNull info: AccessibilityNodeInfo)

Creates a new instance wrapping an android.view.accessibility.AccessibilityNodeInfo.

open static AccessibilityNodeInfoCompat!
obtain(source: View!)

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

open static AccessibilityNodeInfoCompat!
obtain(root: View!, virtualDescendantId: Int)

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

open static AccessibilityNodeInfoCompat!

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

open static AccessibilityNodeInfoCompat!

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

Constants

ACTION_FOCUS

static val ACTION_FOCUS: Int

Action that focuses the node.

Value: 0x00000001

ACTION_CLEAR_FOCUS

static val ACTION_CLEAR_FOCUS: Int

Action that unfocuses the node.

Value: 0x00000002

ACTION_SELECT

static val ACTION_SELECT: Int

Action that selects the node.

Value: 0x00000004

ACTION_CLEAR_SELECTION

static val ACTION_CLEAR_SELECTION: Int

Action that unselects the node.

Value: 0x00000008

ACTION_CLICK

static val ACTION_CLICK: Int

Action that clicks on the node info.

Value: 0x00000010

ACTION_LONG_CLICK

static val ACTION_LONG_CLICK: Int

Action that long clicks on the node.

Value: 0x00000020

ACTION_ACCESSIBILITY_FOCUS

static val ACTION_ACCESSIBILITY_FOCUS: Int

Action that gives accessibility focus to the node.

Value: 0x00000040

ACTION_CLEAR_ACCESSIBILITY_FOCUS

static val ACTION_CLEAR_ACCESSIBILITY_FOCUS: Int

Action that clears accessibility focus of the node.

Value: 0x00000080

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.


          

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

Value: 0x00000100

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.


          

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

Value: 0x00000200

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:


          

Bundle arguments = new Bundle(); arguments.putString(AccessibilityNodeInfo.ACTION_ARGUMENT_HTML_ELEMENT_STRING, "BUTTON"); info.performAction(AccessibilityNodeInfo.ACTION_NEXT_HTML_ELEMENT, arguments);

Value: 0x00000400

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:


          

Bundle arguments = new Bundle(); arguments.putString(AccessibilityNodeInfo.ACTION_ARGUMENT_HTML_ELEMENT_STRING, "BUTTON"); info.performAction(AccessibilityNodeInfo.ACTION_PREVIOUS_HTML_ELEMENT, arguments);

Value: 0x00000800

ACTION_SCROLL_FORWARD

static val ACTION_SCROLL_FORWARD: Int

Action to scroll the node content forward.

Value: 0x00001000

ACTION_SCROLL_BACKWARD

static val ACTION_SCROLL_BACKWARD: Int

Action to scroll the node content backward.

Value: 0x00002000

ACTION_COPY

static val ACTION_COPY: Int

Action to copy the current selection to the clipboard.

Value: 0x00004000

ACTION_PASTE

static val ACTION_PASTE: Int

Action to paste the current clipboard content.

Value: 0x00008000

ACTION_CUT

static val ACTION_CUT: Int

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

Value: 0x00010000

ACTION_SET_SELECTION

static val ACTION_SET_SELECTION: Int

Action to set the selection. Performing this action with no arguments clears the selection.

Arguments: ACTION_ARGUMENT_SELECTION_START_INT, ACTION_ARGUMENT_SELECTION_END_INT
Example:


          

Bundle arguments = new Bundle(); arguments.putInt(AccessibilityNodeInfo.ACTION_ARGUMENT_SELECTION_START_INT, 1); arguments.putInt(AccessibilityNodeInfo.ACTION_ARGUMENT_SELECTION_END_INT, 2); info.performAction(AccessibilityNodeInfo.ACTION_SET_SELECTION, arguments);

Value: 0x00020000

ACTION_EXPAND

static val ACTION_EXPAND: Int

Action to expand an expandable node.

Value: 0x00040000

ACTION_COLLAPSE

static val ACTION_COLLAPSE: Int

Action to collapse an expandable node.

Value: 0x00080000

ACTION_DISMISS

static val ACTION_DISMISS: Int

Action to dismiss a dismissable node.

Value: 0x00100000

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.

Arguments: ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE
Example:


          

Bundle arguments = new Bundle(); arguments.putCharSequence(AccessibilityNodeInfo.ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE, "android"); info.performAction(AccessibilityNodeInfo.ACTION_SET_TEXT, arguments);

Value: 0x00200000

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: ACTION_NEXT_AT_MOVEMENT_GRANULARITY, ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY

Value: "ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT"

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: ACTION_NEXT_HTML_ELEMENT, ACTION_PREVIOUS_HTML_ELEMENT

Value: "ACTION_ARGUMENT_HTML_ELEMENT_STRING"

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: ACTION_NEXT_AT_MOVEMENT_GRANULARITY, ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY

Value: "ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN"

ACTION_ARGUMENT_SELECTION_START_INT

static val ACTION_ARGUMENT_SELECTION_START_INT: String

Argument for specifying the selection start.

Type: int
Actions: ACTION_SET_SELECTION

Value: "ACTION_ARGUMENT_SELECTION_START_INT"

ACTION_ARGUMENT_SELECTION_END_INT

static val ACTION_ARGUMENT_SELECTION_END_INT: String

Argument for specifying the selection end.

Type: int
Actions: ACTION_SET_SELECTION

Value: "ACTION_ARGUMENT_SELECTION_END_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: ACTION_SET_TEXT

Value: "ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE"

See Also

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

FOCUS_INPUT

static val FOCUS_INPUT: Int

The input focus.

Value: 1

FOCUS_ACCESSIBILITY

static val FOCUS_ACCESSIBILITY: Int

The accessibility focus.

Value: 2

MOVEMENT_GRANULARITY_CHARACTER

static val MOVEMENT_GRANULARITY_CHARACTER: Int

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

Value: 0x00000001

MOVEMENT_GRANULARITY_WORD

static val MOVEMENT_GRANULARITY_WORD: Int

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

Value: 0x00000002

MOVEMENT_GRANULARITY_LINE

static val MOVEMENT_GRANULARITY_LINE: Int

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

Value: 0x00000004

MOVEMENT_GRANULARITY_PARAGRAPH

static val MOVEMENT_GRANULARITY_PARAGRAPH: Int

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

Value: 0x00000008

MOVEMENT_GRANULARITY_PAGE

static val MOVEMENT_GRANULARITY_PAGE: Int

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

Value: 0x00000010

Public constructors

<init>

AccessibilityNodeInfoCompat(info: Any!)

Deprecated: Use wrap(AccessibilityNodeInfo) instead.

Creates a new instance wrapping an android.view.accessibility.AccessibilityNodeInfo.

Parameters
info Any!: The info.

Public methods

setViewIdResourceName

open fun setViewIdResourceName(viewId: 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
viewId String!: The id resource name.

getWindowId

open fun getWindowId(): Int

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

Return
Int: The window id.

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, in a login screen with a TextView that displays an "incorrect password" notification, that view should be marked as a live region with mode ViewCompat#ACCESSIBILITY_LIVE_REGION_POLITE.

It is the responsibility of the accessibility service to monitor AccessibilityEventCompat#TYPE_WINDOW_CONTENT_CHANGED events indicating changes to live region nodes and their children.

Return
Int: The live region mode, or ViewCompat#ACCESSIBILITY_LIVE_REGION_NONE if the view is not a live region.

getError

open fun getError(): CharSequence!

Gets the error text of this node.

Return
CharSequence!: The error text.

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.

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

isEditable

open fun isEditable(): Boolean

Gets if the node is editable.

Return
Boolean: True if the node is editable, false otherwise.

getMovementGranularities

open fun getMovementGranularities(): Int

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

Return
Int: The bit mask with granularities.

getBoundsInParent

open fun getBoundsInParent(outBounds: Rect!): Unit

Gets the node bounds in parent coordinates.

Parameters
outBounds Rect!: The output node bounds.

getTooltipText

@Nullable open fun getTooltipText(): CharSequence?

Gets the tooltip text of this node.

Return
CharSequence?: The tooltip text.

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
IllegalStateException If called from an AccessibilityService.

getChildCount

open fun getChildCount(): Int

Gets the number of children.

Return
Int: The child count.

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 ViewCompat#ACCESSIBILITY_LIVE_REGION_NONE if the view is not a live region.

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
IllegalStateException If called from an AccessibilityService.

isClickable

open fun isClickable(): Boolean

Gets whether this node is clickable.

Return
Boolean: True if the node is clickable.

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.

Parameters
focused Boolean: True if the node is accessibility focused.
Exceptions
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.

getPaneTitle

@Nullable 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.

refresh

open fun refresh(): Boolean

Refreshes this info with the latest state of the view it represents.

Note: If this method returns false this info is obsolete since it represents a view that is no longer in the view tree and should be recycled.

Return
Boolean: Whether the refresh succeeded.

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
IllegalStateException If called from an AccessibilityService.

getRangeInfo

open fun getRangeInfo(): AccessibilityNodeInfoCompat.RangeInfoCompat!

Gets the range info if this node is a range.

Return
AccessibilityNodeInfoCompat.RangeInfoCompat!: The range.

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.

getInputType

open fun getInputType(): Int

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

Return
Int: The input type.

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
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 View!: The id of the virtual descendant.

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
IllegalStateException If called from an AccessibilityService.

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
IllegalStateException If called from an AccessibilityService.

setRangeInfo

open fun setRangeInfo(rangeInfo: AccessibilityNodeInfoCompat.RangeInfoCompat!): 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 AccessibilityNodeInfoCompat.RangeInfoCompat!: The range info.

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
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
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 View!: The id of the virtual child.
Return
Boolean: true if the child was present

recycle

open fun recycle(): Unit

Return an instance back to be reused.

Note: You must not touch the object after calling this function.

Exceptions
IllegalStateException If the info is already recycled.

focusSearch

open fun focusSearch(direction: Int): AccessibilityNodeInfoCompat!

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

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
AccessibilityNodeInfoCompat!: The node info for the view that can take accessibility focus.

isCheckable

open fun isCheckable(): Boolean

Gets whether this node is checkable.

Return
Boolean: True if the node is checkable.

getHintText

@Nullable 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.

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.

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 View!: The id of the virtual descendant.

setSource

open fun setSource(source: View!): Unit

Sets the source.

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 View!: The id of the virtual descendant.

isVisibleToUser

open fun isVisibleToUser(): Boolean

Gets whether this node is visible to the user.

Return
Boolean: Whether the node is visible to the user.

isLongClickable

open fun isLongClickable(): Boolean

Gets whether this node is long clickable.

Return
Boolean: True if the node is long clickable.

getTraversalAfter

open fun getTraversalAfter(): AccessibilityNodeInfoCompat!

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
AccessibilityNodeInfoCompat!: The succeeding node if such or null.

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
IllegalStateException If called from an AccessibilityService.

isMultiLine

open fun isMultiLine(): Boolean

Gets if the node is a multi line editable text.

Return
Boolean: True if the node is multi line.

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
IllegalStateException If called from an AccessibilityService.

getTraversalBefore

open fun getTraversalBefore(): AccessibilityNodeInfoCompat!

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
AccessibilityNodeInfoCompat!: The succeeding node if such or null.

setTooltipText

open fun setTooltipText(@Nullable tooltipText: CharSequence?): Unit

Sets the tooltip text of this node.

This method has no effect below API 19

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.
Exceptions
IllegalStateException If called from an AccessibilityService.

isSelected

open fun isSelected(): Boolean

Gets whether this node is selected.

Return
Boolean: True if the node is selected.

setCollectionItemInfo

open fun setCollectionItemInfo(collectionItemInfo: Any!): Unit

isPassword

open fun isPassword(): Boolean

Gets whether this node is a password.

Return
Boolean: True if the node is a password.

setPaneTitle

open fun setPaneTitle(@Nullable 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.

This method has no effect below API 19

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 window represented by this node.

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.

findAccessibilityNodeInfosByText

open fun findAccessibilityNodeInfosByText(text: String!): MutableList<AccessibilityNodeInfoCompat!>!

Finds android.view.accessibility.AccessibilityNodeInfos by text. The match is case insensitive containment. The search is relative to this info i.e. this info is the root of the traversed tree.

Note: It is a client responsibility to recycle the received info by calling android.view.accessibility.AccessibilityNodeInfo#recycle() to avoid creating of multiple instances.

Parameters
text String!: The searched text.
Return
MutableList<AccessibilityNodeInfoCompat!>!: A list of node info.

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

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
IllegalStateException If called from an AccessibilityService.

getTextSelectionStart

open fun getTextSelectionStart(): Int

Gets the text selection start.

Return
Int: The text selection start if there is selection or -1.

removeAction

open fun removeAction(action: AccessibilityNodeInfoCompat.AccessibilityActionCompat!): 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 AccessibilityNodeInfoCompat.AccessibilityActionCompat!: The action to be removed.
Return
Boolean: The action removed from the list of actions.
Exceptions
IllegalStateException If called from an AccessibilityService.

Compatibility:

  • API < 21: Always returns false

equals

open fun equals(other: Any?): Boolean

setCollectionInfo

open fun setCollectionInfo(collectionInfo: Any!): Unit

isFocused

open fun isFocused(): Boolean

Gets whether this node is focused.

Return
Boolean: True if the node is focused.

setHintText

open fun setHintText(@Nullable hintText: CharSequence?): Unit

Sets the hint text of this node. Only applies to nodes where text can be entered.

This method has no effect below API 19

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
IllegalStateException If called from an AccessibilityService.

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

Parameters
focusable Boolean: True if the node is focusable.
Exceptions
IllegalStateException If called from an AccessibilityService.

isContextClickable

open fun isContextClickable(): Boolean

Gets whether this node is context clickable.

Return
Boolean: True if the node is context clickable.

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.

Parameters
child View!: The child.
Exceptions
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.

Parameters
root View!: The root of the virtual subtree.
virtualDescendantId View!: The id of the virtual child.

getActionList

open fun getActionList(): MutableList<AccessibilityNodeInfoCompat.AccessibilityActionCompat!>!

Gets the actions that can be performed on the node.

Return
MutableList<AccessibilityNodeInfoCompat.AccessibilityActionCompat!>!: A list of AccessibilityActions.

Compatibility:

  • API < 21: Always returns 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
IllegalStateException If called from an AccessibilityService.

getCollectionInfo

open fun getCollectionInfo(): AccessibilityNodeInfoCompat.CollectionInfoCompat!

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

Return
AccessibilityNodeInfoCompat.CollectionInfoCompat!: The collection info.

findFocus

open fun findFocus(focus: Int): AccessibilityNodeInfoCompat!

Find the view that has the specified focus type. The search starts from the view represented by this node info.

Parameters
focus Int: The focus to find. One of FOCUS_INPUT or FOCUS_ACCESSIBILITY.
Return
AccessibilityNodeInfoCompat!: The node info of the focused view or null.

isScrollable

open fun isScrollable(): Boolean

Gets if the node is scrollable.

Return
Boolean: True if the node is scrollable, false otherwise.

getContentDescription

open fun getContentDescription(): CharSequence!

Gets the content description of this node.

Return
CharSequence!: The content description.

getText

open fun getText(): CharSequence!

Gets the text of this node.

Return
CharSequence!: The text.

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.

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 View!: The id of the virtual descendant.

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
IllegalStateException If called from an AccessibilityService.

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.

setChecked

open fun setChecked(checked: Boolean): Unit

Sets whether this node is checked.

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
IllegalStateException If called from an AccessibilityService.

getLabelFor

open fun getLabelFor(): AccessibilityNodeInfoCompat!

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

Note: It is a client responsibility to recycle the received info by calling AccessibilityNodeInfoCompat#recycle() to avoid creating of multiple instances.

Return
AccessibilityNodeInfoCompat!: The labeled info.

setLabeledBy

open fun setLabeledBy(label: View!): Unit

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 fun setLabeledBy(root: View!, virtualDescendantId: Int): Unit

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 View!: The id of the virtual descendant.

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
IllegalStateException If called from an AccessibilityService.

isDismissable

open fun isDismissable(): Boolean

Gets if the node can be dismissed.

Return
Boolean: If the node can be dismissed.

getBoundsInScreen

open fun getBoundsInScreen(outBounds: Rect!): Unit

Gets the node bounds in screen coordinates.

Parameters
outBounds Rect!: The output node bounds.

hashCode

open fun hashCode(): Int

setBoundsInParent

open fun setBoundsInParent(bounds: Rect!): Unit

Sets the node bounds in parent 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
IllegalStateException If called from an AccessibilityService.

toString

open fun toString(): String

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.

Parameters
root View!: The root whose virtual descendant serves as a label.
virtualDescendantId View!: The id of the virtual descendant.

getChild

open fun getChild(index: Int): AccessibilityNodeInfoCompat!

Get the child at given index.

Note: It is a client responsibility to recycle the received info by calling AccessibilityNodeInfoCompat#recycle() to avoid creating of multiple instances.

Parameters
index Int: The child index.
Return
AccessibilityNodeInfoCompat!: The child node.
Exceptions
IllegalStateException If called outside of an AccessibilityService.

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.

isEnabled

open fun isEnabled(): Boolean

Gets whether this node is enabled.

Return
Boolean: True if the node is enabled.

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

isFocusable

open fun isFocusable(): Boolean

Gets whether this node is focusable.

Return
Boolean: True if the node is focusable.

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

getPackageName

open fun getPackageName(): CharSequence!

Gets the package this node comes from.

Return
CharSequence!: The package name.

getInfo

open fun getInfo(): Any!
Return
Any!: The wrapped android.view.accessibility.AccessibilityNodeInfo.

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.

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
IllegalStateException If called from an AccessibilityService.

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.

getClassName

open fun getClassName(): CharSequence!

Gets the class this node comes from.

Return
CharSequence!: The class name.

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
IllegalStateException If called from an AccessibilityService.

getLabeledBy

open fun getLabeledBy(): AccessibilityNodeInfoCompat!

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

Note: It is a client responsibility to recycle the received info by calling AccessibilityNodeInfoCompat#recycle() to avoid creating of multiple instances.

Return
AccessibilityNodeInfoCompat!: The label.

isChecked

open fun isChecked(): Boolean

Gets whether this node is checked.

Return
Boolean: True if the node is checked.

isAccessibilityFocused

open fun isAccessibilityFocused(): Boolean

Gets whether this node is accessibility focused.

Return
Boolean: True if the node is accessibility focused.

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 AccessibilityNodeInfoCompat the client has to set the AccessibilityServiceInfoCompat#FLAG_REPORT_VIEW_IDS flag when configuring his android.accessibilityservice.AccessibilityService.

Return
String!: The id resource name.

getTextSelectionEnd

open fun getTextSelectionEnd(): Int

Gets the text selection end.

Return
Int: The text selection end if there is selection or -1.

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
IllegalStateException If called from an AccessibilityService.

addAction

open fun addAction(action: Int): Unit

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
IllegalStateException If called from an AccessibilityService.

addAction

open fun addAction(action: AccessibilityNodeInfoCompat.AccessibilityActionCompat!): Unit

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 AccessibilityNodeInfoCompat.AccessibilityActionCompat!: The action.
Exceptions
IllegalStateException If called from an AccessibilityService.

Compatibility:

  • API < 21: No-op

setHeading

open fun setHeading(isHeading: Boolean): Unit

Sets whether the node represents a heading.

This method has no effect below API 19

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.

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
IllegalStateException If called from an AccessibilityService.

getMaxTextLength

open fun getMaxTextLength(): Int

Returns the maximum text length for this node.

Return
Int: The maximum text length, or -1 for no limit.

canOpenPopup

open fun canOpenPopup(): Boolean

Gets if this node opens a popup or a dialog.

Return
Boolean: If the the node opens a popup.

setScreenReaderFocusable

open fun setScreenReaderFocusable(screenReaderFocusable: Boolean): Unit

Sets whether the node should be considered a focusable unit by a screen reader.

This method has no effect below API 19

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

Parameters
screenReaderFocusable Boolean: true if the node is a focusable unit for screen readers, false otherwise.

getCollectionItemInfo

open fun getCollectionItemInfo(): AccessibilityNodeInfoCompat.CollectionItemInfoCompat!

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

Return
AccessibilityNodeInfoCompat.CollectionItemInfoCompat!: The collection item info.

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.

This method has no effect below API 19

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.

getParent

open fun getParent(): AccessibilityNodeInfoCompat!

Gets the parent.

Note: It is a client responsibility to recycle the received info by calling android.view.accessibility.AccessibilityNodeInfo#recycle() to avoid creating of multiple instances.

Return
AccessibilityNodeInfoCompat!: The parent.

getWindow

open fun getWindow(): AccessibilityWindowInfoCompat!

Gets the window to which this node belongs.

Return
AccessibilityWindowInfoCompat!: The window.

findAccessibilityNodeInfosByViewId

open fun findAccessibilityNodeInfosByViewId(viewId: String!): MutableList<AccessibilityNodeInfoCompat!>!

Finds AccessibilityNodeInfoCompats by the fully qualified view id's resource name where a fully qualified id is of the from "package:id/id_resource_name". For example, if the target application's package is "foo.bar" and the id resource name is "baz", the fully qualified resource id is "foo.bar:id/baz".

Note: It is a client responsibility to recycle the received info by calling AccessibilityNodeInfoCompat#recycle() to avoid creating of multiple instances.

Note: The primary usage of this API is for UI test automation and in order to report the fully qualified view id if an AccessibilityNodeInfoCompat the client has to set the android.accessibilityservice.AccessibilityServiceInfo#FLAG_REPORT_VIEW_IDS flag when configuring his android.accessibilityservice.AccessibilityService.

Parameters
viewId String!: The fully qualified resource name of the view id to find.
Return
MutableList<AccessibilityNodeInfoCompat!>!: A list of node info.

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
IllegalStateException If called from an AccessibilityService.

getRoleDescription

@Nullable open fun getRoleDescription(): CharSequence?

Gets the custom role description.

Return
CharSequence?: The role description.

setRoleDescription

open fun setRoleDescription(@Nullable roleDescription: CharSequence?): Unit

Sets the custom role description.

The role description allows you to customize the name for the view's semantic role. For example, if you create a custom subclass of android.view.View to display a menu bar, you could assign it the role description of "menu bar".

Warning: For consistency with other applications, you should not use the role description to force accessibility services to describe standard views (such as buttons or checkboxes) using specific wording. For example, you should not set a role description of "check box" or "tick box" for a standard android.widget.CheckBox. Instead let accessibility services decide what feedback to provide.

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

Parameters
roleDescription CharSequence?: The role description.

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
IllegalStateException If called from an AccessibilityService.

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
IllegalStateException If called from an AccessibilityService.

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
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 Int: A bundle with additional arguments.
Return
Boolean: True if the action was performed.
Exceptions
IllegalStateException If called outside of 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
IllegalStateException If called from an AccessibilityService.

wrap

open static fun wrap(@NonNull info: AccessibilityNodeInfo): AccessibilityNodeInfoCompat!

Creates a new instance wrapping an android.view.accessibility.AccessibilityNodeInfo.

Parameters
info AccessibilityNodeInfo: The info.

obtain

open static fun obtain(source: View!): AccessibilityNodeInfoCompat!

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

Return
AccessibilityNodeInfoCompat!: An instance.

See Also

obtain

open static fun obtain(root: View!, virtualDescendantId: Int): AccessibilityNodeInfoCompat!

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 View!: The id of the virtual descendant.
Return
AccessibilityNodeInfoCompat!: An instance.

obtain

open static fun obtain(): AccessibilityNodeInfoCompat!

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

Return
AccessibilityNodeInfoCompat!: An instance.

obtain

open static fun obtain(info: AccessibilityNodeInfoCompat!): AccessibilityNodeInfoCompat!

Returns a cached instance if such is available or a new one is create. The returned instance is initialized from the given info.

Parameters
info AccessibilityNodeInfoCompat!: The other info.
Return
AccessibilityNodeInfoCompat!: An instance.