Android Dev Summit, October 23-24: two days of technical content, directly from the Android team. Sign-up for livestream updates.

AccessibilityEventCompat

class AccessibilityEventCompat
kotlin.Any
   ↳ androidx.core.view.accessibility.AccessibilityEventCompat

Helper for accessing features in AccessibilityEvent.

Summary

Constants

static Int

Change type for TYPE_WINDOW_CONTENT_CHANGED event: The node's content description changed.

static Int

Change type for AccessibilityEvent#TYPE_WINDOW_STATE_CHANGED event: The node has a pane title, and either just appeared or just was assigned a title when it had none before.

static Int

Change type for AccessibilityEvent#TYPE_WINDOW_STATE_CHANGED event: Can mean one of two slightly different things.

static Int

Change type for AccessibilityEvent#TYPE_WINDOW_STATE_CHANGED event: The node's pane title changed.

static Int

Change type for TYPE_WINDOW_CONTENT_CHANGED event: A node in the subtree rooted at the source node was added or removed.

static Int

Change type for TYPE_WINDOW_CONTENT_CHANGED event: The node's text changed.

static Int

Change type for TYPE_WINDOW_CONTENT_CHANGED event: The type of change is not defined.

static Int

Mask for AccessibilityEvent all types.

static Int

Represents the event of an application making an announcement.

static Int

Represents the event of the assistant currently reading the users screen context.

static Int

Represents the event of ending gesture detection.

static Int

Represents the event of beginning gesture detection.

static Int

Represents the event of ending a touch exploration gesture.

static Int

Represents the event of starting a touch exploration gesture.

static Int

Represents the event of the user ending to touch the screen.

static Int

Represents the event of the user starting to touch the screen.

static Int

Represents the event of gaining accessibility focus.

static Int

Represents the event of clearing accessibility focus.

static Int

Represents the event of a context click on a android.view.View.

static Int

Represents the event of a hover enter over a android.view.View.

static Int

Represents the event of a hover exit over a android.view.View.

static Int

Represents the event of scrolling a view.

static Int

Represents the event of changing the selection in an android.widget.EditText.

static Int

Represents the event of traversing the text of a view at a given movement granularity.

static Int

Represents the event change in the windows shown on the screen.

static Int

Represents the event of changing the content of a window.

Public methods

static Unit

Appends an android.view.accessibility.AccessibilityRecord to the end of event records.

static AccessibilityRecordCompat!

Creates an AccessibilityRecordCompat from an AccessibilityEvent that can be used to manipulate the event properties defined in android.view.accessibility.AccessibilityRecord.

static Int

Gets the performed action that triggered this event.

static Int

Gets the bit mask of change types signaled by an TYPE_WINDOW_CONTENT_CHANGED event.

static Int

Gets the movement granularity that was traversed.

static AccessibilityRecordCompat!
getRecord(event: AccessibilityEvent!, index: Int)

Gets the record at a given index.

static Int

Gets the number of records contained in the event.

static Unit
setAction(event: AccessibilityEvent!, action: Int)

Sets the performed action that triggered this event.

static Unit

Sets the bit mask of node tree changes signaled by an TYPE_WINDOW_CONTENT_CHANGED event.

static Unit

Sets the movement granularity that was traversed.

Constants

CONTENT_CHANGE_TYPE_CONTENT_DESCRIPTION

static val CONTENT_CHANGE_TYPE_CONTENT_DESCRIPTION: Int

Change type for TYPE_WINDOW_CONTENT_CHANGED event: The node's content description changed.

Value: 0x00000004

CONTENT_CHANGE_TYPE_PANE_APPEARED

static val CONTENT_CHANGE_TYPE_PANE_APPEARED: Int

Change type for AccessibilityEvent#TYPE_WINDOW_STATE_CHANGED event: The node has a pane title, and either just appeared or just was assigned a title when it had none before.

Value: 0x00000010

CONTENT_CHANGE_TYPE_PANE_DISAPPEARED

static val CONTENT_CHANGE_TYPE_PANE_DISAPPEARED: Int

Change type for AccessibilityEvent#TYPE_WINDOW_STATE_CHANGED event: Can mean one of two slightly different things. The primary meaning is that the node has a pane title, and was removed from the node hierarchy. It can also be sent if the pane title is set to null after it contained a title. No source will be returned if the node is no longer on the screen. To make the change more clear for the user, the first entry in AccessibilityRecord#getText() can return the value that would have been returned by getSource().getPaneTitle().

Value: 0x00000020

CONTENT_CHANGE_TYPE_PANE_TITLE

static val CONTENT_CHANGE_TYPE_PANE_TITLE: Int

Change type for AccessibilityEvent#TYPE_WINDOW_STATE_CHANGED event: The node's pane title changed.

Value: 0x00000008

CONTENT_CHANGE_TYPE_SUBTREE

static val CONTENT_CHANGE_TYPE_SUBTREE: Int

Change type for TYPE_WINDOW_CONTENT_CHANGED event: A node in the subtree rooted at the source node was added or removed.

Value: 0x00000001

CONTENT_CHANGE_TYPE_TEXT

static val CONTENT_CHANGE_TYPE_TEXT: Int

Change type for TYPE_WINDOW_CONTENT_CHANGED event: The node's text changed.

Value: 0x00000002

CONTENT_CHANGE_TYPE_UNDEFINED

static val CONTENT_CHANGE_TYPE_UNDEFINED: Int

Change type for TYPE_WINDOW_CONTENT_CHANGED event: The type of change is not defined.

Value: 0x00000000

TYPE_ANNOUNCEMENT

static val TYPE_ANNOUNCEMENT: Int

Represents the event of an application making an announcement.

Value: 0x00004000

TYPE_ASSIST_READING_CONTEXT

static val TYPE_ASSIST_READING_CONTEXT: Int

Represents the event of the assistant currently reading the users screen context.

Value: 0x01000000

TYPE_GESTURE_DETECTION_END

static val TYPE_GESTURE_DETECTION_END: Int

Represents the event of ending gesture detection.

Value: 0x00080000

TYPE_GESTURE_DETECTION_START

static val TYPE_GESTURE_DETECTION_START: Int

Represents the event of beginning gesture detection.

Value: 0x00040000

TYPE_TOUCH_EXPLORATION_GESTURE_END

static val TYPE_TOUCH_EXPLORATION_GESTURE_END: Int

Deprecated: Use AccessibilityEvent#TYPE_TOUCH_EXPLORATION_GESTURE_END directly.

Represents the event of ending a touch exploration gesture.

Value: AccessibilityEvent.TYPE_TOUCH_EXPLORATION_GESTURE_END

TYPE_TOUCH_EXPLORATION_GESTURE_START

static val TYPE_TOUCH_EXPLORATION_GESTURE_START: Int

Deprecated: Use AccessibilityEvent#TYPE_TOUCH_EXPLORATION_GESTURE_START directly.

Represents the event of starting a touch exploration gesture.

Value: AccessibilityEvent.TYPE_TOUCH_EXPLORATION_GESTURE_START

TYPE_TOUCH_INTERACTION_END

static val TYPE_TOUCH_INTERACTION_END: Int

Represents the event of the user ending to touch the screen.

Value: 0x00200000

TYPE_TOUCH_INTERACTION_START

static val TYPE_TOUCH_INTERACTION_START: Int

Represents the event of the user starting to touch the screen.

Value: 0x00100000

TYPE_VIEW_ACCESSIBILITY_FOCUSED

static val TYPE_VIEW_ACCESSIBILITY_FOCUSED: Int

Represents the event of gaining accessibility focus.

Value: 0x00008000

TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED

static val TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED: Int

Represents the event of clearing accessibility focus.

Value: 0x00010000

TYPE_VIEW_CONTEXT_CLICKED

static val TYPE_VIEW_CONTEXT_CLICKED: Int

Represents the event of a context click on a android.view.View.

Value: 0x00800000

TYPE_VIEW_HOVER_ENTER

static val TYPE_VIEW_HOVER_ENTER: Int

Deprecated: Use AccessibilityEvent#TYPE_VIEW_HOVER_ENTER directly.

Represents the event of a hover enter over a android.view.View.

Value: AccessibilityEvent.TYPE_VIEW_HOVER_ENTER

TYPE_VIEW_HOVER_EXIT

static val TYPE_VIEW_HOVER_EXIT: Int

Deprecated: Use AccessibilityEvent#TYPE_VIEW_HOVER_EXIT directly.

Represents the event of a hover exit over a android.view.View.

Value: AccessibilityEvent.TYPE_VIEW_HOVER_EXIT

TYPE_VIEW_SCROLLED

static val TYPE_VIEW_SCROLLED: Int

Deprecated: Use AccessibilityEvent#TYPE_VIEW_SCROLLED directly.

Represents the event of scrolling a view.

Value: AccessibilityEvent.TYPE_VIEW_SCROLLED

TYPE_VIEW_TEXT_SELECTION_CHANGED

static val TYPE_VIEW_TEXT_SELECTION_CHANGED: Int

Deprecated: Use AccessibilityEvent#TYPE_VIEW_TEXT_SELECTION_CHANGED directly.

Represents the event of changing the selection in an android.widget.EditText.

Value: AccessibilityEvent.TYPE_VIEW_TEXT_SELECTION_CHANGED

TYPE_VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY

static val TYPE_VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY: Int

Represents the event of traversing the text of a view at a given movement granularity.

Value: 0x00020000

TYPE_WINDOWS_CHANGED

static val TYPE_WINDOWS_CHANGED: Int

Represents the event change in the windows shown on the screen.

Value: 0x00400000

TYPE_WINDOW_CONTENT_CHANGED

static val TYPE_WINDOW_CONTENT_CHANGED: Int

Deprecated: Use AccessibilityEvent#TYPE_WINDOW_CONTENT_CHANGED directly.

Represents the event of changing the content of a window.

Value: AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED

Public methods

appendRecord

static fun appendRecord(event: AccessibilityEvent!, record: AccessibilityRecordCompat!): Unit

Deprecated: Use AccessibilityEvent#appendRecord(AccessibilityRecord) directly.

Appends an android.view.accessibility.AccessibilityRecord to the end of event records.

Parameters
record AccessibilityEvent!: The record to append.
Exceptions
IllegalStateException If called from an AccessibilityService.

asRecord

static fun asRecord(event: AccessibilityEvent!): AccessibilityRecordCompat!

Deprecated: Use the AccessibilityEvent directly as AccessibilityRecord.

Creates an AccessibilityRecordCompat from an AccessibilityEvent that can be used to manipulate the event properties defined in android.view.accessibility.AccessibilityRecord.

Note: Do not call AccessibilityRecordCompat#recycle() on the returned AccessibilityRecordCompat. Call AccessibilityEvent#recycle() in case you want to recycle the event.

Parameters
event AccessibilityEvent!: The from which to create a record.
Return
AccessibilityRecordCompat!: An AccessibilityRecordCompat.

getAction

static fun getAction(event: AccessibilityEvent!): Int

Gets the performed action that triggered this event.

Return
Int: The action.

getContentChangeTypes

static fun getContentChangeTypes(event: AccessibilityEvent!): Int

Gets the bit mask of change types signaled by an TYPE_WINDOW_CONTENT_CHANGED event. A single event may represent multiple change types.

Return
Int: The bit mask of change types. One or more of:

getMovementGranularity

static fun getMovementGranularity(event: AccessibilityEvent!): Int

Gets the movement granularity that was traversed.

Return
Int: The granularity.

getRecord

static fun getRecord(event: AccessibilityEvent!, index: Int): AccessibilityRecordCompat!

Deprecated: Use AccessibilityEvent#getRecord(int) directly.

Gets the record at a given index.

Parameters
index AccessibilityEvent!: The index.
Return
AccessibilityRecordCompat!: The record at the specified index.

getRecordCount

static fun getRecordCount(event: AccessibilityEvent!): Int

Deprecated: Use AccessibilityEvent#getRecordCount() directly.

Gets the number of records contained in the event.

Return
Int: The number of records.

setAction

static fun setAction(event: AccessibilityEvent!, action: Int): Unit

Sets the performed action that triggered this event.

Valid actions are defined in AccessibilityNodeInfoCompat:

Parameters
action AccessibilityEvent!: The action.
Exceptions
IllegalStateException If called from an AccessibilityService.

setContentChangeTypes

static fun setContentChangeTypes(event: AccessibilityEvent!, changeTypes: Int): Unit

Sets the bit mask of node tree changes signaled by an TYPE_WINDOW_CONTENT_CHANGED event.

Parameters
changeTypes AccessibilityEvent!: The bit mask of change types.
Exceptions
IllegalStateException If called from an AccessibilityService.

setMovementGranularity

static fun setMovementGranularity(event: AccessibilityEvent!, granularity: Int): Unit

Sets the movement granularity that was traversed.

Parameters
granularity AccessibilityEvent!: The granularity.
Exceptions
IllegalStateException If called from an AccessibilityService.