Android Guides | Samples

Android.Views.Accessibility.AccessibilityEvent Class

Developer Guides

View text traversed at movement granularity - represents the event of traversing the text of a view at a given granularity.

See Also: AccessibilityEvent

Syntax

[Android.Runtime.Register("android/view/accessibility/AccessibilityEvent", DoNotGenerateAcw=true)]
public sealed class AccessibilityEvent : AccessibilityRecord, IParcelable, IDisposable

Remarks

Developer Guides

View text traversed at movement granularity - represents the event of traversing the text of a view at a given granularity. For example, moving to the next word.
Type:AccessibilityEventCompat.TypeViewTextTraversedAtMovementGranularity
Properties:

This class represents accessibility events that are sent by the system when something notable happens in the user interface. For example, when a Button is clicked, a View is focused, etc.

An accessibility event is fired by an individual view which populates the event with data for its state and requests from its parent to send the event to interested parties. The parent can optionally add an AccessibilityRecord for itself before dispatching a similar request to its parent. A parent can also choose not to respect the request for sending an event. The accessibility event is sent by the topmost view in the view tree. Therefore, an AccessibilityService can explore all records in an accessibility event to obtain more information about the context in which the event was fired.

The main purpose of an accessibility event is to expose enough information for an AccessibilityService to provide meaningful feedback to the user. Sometimes however, an accessibility service may need more contextual information then the one in the event pay-load. In such cases the service can obtain the event source which is an AccessibilityNodeInfo (snapshot of a View state) which can be used for exploring the window content. Note that the privilege for accessing an event's source, thus the window content, has to be explicitly requested. For more details refer to AccessibilityService. If an accessibility service has not requested to retrieve the window content the event will not contain reference to its source. Also for events of type EventTypes.NotificationStateChanged the source is never available.

This class represents various semantically different accessibility event types. Each event type has an associated set of related properties. In other words, each event type is characterized via a subset of the properties exposed by this class. For each event type there is a corresponding constant defined in this class. Follows a specification of the event types and their associated properties:

For more information about creating and processing AccessibilityEvents, read the Accessibility developer guide.

VIEW TYPES

View clicked - represents the event of clicking on a View like Button, CompoundButton, etc.
Type:EventTypes.ViewClicked
Properties:

View long clicked - represents the event of long clicking on a View like Button, CompoundButton, etc
Type:EventTypes.ViewLongClicked
Properties:

View selected - represents the event of selecting an item usually in the context of an AdapterView.
Type:EventTypes.ViewSelected
Properties:

View focused - represents the event of focusing a View.
Type:EventTypes.ViewFocused
Properties:

View text changed - represents the event of changing the text of an EditText.
Type:EventTypes.ViewTextChanged
Properties:

View text selection changed - represents the event of changing the text selection of an EditText.
Type:AccessibilityEventCompat.TypeViewTextSelectionChanged
Properties:

View scrolled - represents the event of scrolling a view. If the source is a descendant of AdapterView the scroll is reported in terms of visible items - the first visible item, the last visible item, and the total items - because the the source is unaware of its pixel size since its adapter is responsible for creating views. In all other cases the scroll is reported as the current scroll on the X and Y axis respectively plus the height of the source in pixels.
Type:AccessibilityEventCompat.TypeViewScrolled
Properties:

Note: This event type is not dispatched to descendants though View.DispatchPopulateAccessibilityEvent(AccessibilityEvent), hence the event source View and the sub-tree rooted at it will not receive calls to View.OnPopulateAccessibilityEvent(AccessibilityEvent). The preferred way to add text content to such events is by setting the NoType:android/R$styleable;Href=../../../../reference/android/R.styleable.html#View_contentDescription of the source view.

TRANSITION TYPES

Window state changed - represents the event of opening a PopupWindow, Menu, Dialog, etc.
Type:EventTypes.WindowStateChanged
Properties:

Window content changed - represents the event of change in the content of a window. This change can be adding/removing view, changing a view size, etc.

Note: This event is fired only for the window source of the last accessibility event different from EventTypes.NotificationStateChanged and its purpose is to notify clients that the content of the user interaction window has changed.
Type:AccessibilityEventCompat.TypeWindowContentChanged
Properties:

Note: This event type is not dispatched to descendants though View.DispatchPopulateAccessibilityEvent(AccessibilityEvent), hence the event source View and the sub-tree rooted at it will not receive calls to View.OnPopulateAccessibilityEvent(AccessibilityEvent). The preferred way to add text content to such events is by setting the NoType:android/R$styleable;Href=../../../../reference/android/R.styleable.html#View_contentDescription of the source view.

Windows changed - represents the event of changes in the windows shown on the screen such as a window appeared, a window disappeared, a window size changed, a window layer changed, etc.
Type:EventTypes.WindowsChanged
Properties:

Note: You can retrieve the AccessibilityWindowInfo for the window source of the event via AccessibilityRecord.Source to get the source node on which then call AccessibilityNodeInfo.Window to get the window. Also all windows on the screen can be retrieved by a call to AccessibilityService.Windows.

NOTIFICATION TYPES

Notification state changed - represents the event showing Notification.
Type:EventTypes.NotificationStateChanged
Properties:

Note: This event type is not dispatched to descendants though View.DispatchPopulateAccessibilityEvent(AccessibilityEvent), hence the event source View and the sub-tree rooted at it will not receive calls to View.OnPopulateAccessibilityEvent(AccessibilityEvent). The preferred way to add text content to such events is by setting the NoType:android/R$styleable;Href=../../../../reference/android/R.styleable.html#View_contentDescription of the source view.

EXPLORATION TYPES

View hover enter - represents the event of beginning to hover over a View. The hover may be generated via exploring the screen by touch or via a pointing device.
Type:AccessibilityEventCompat.TypeViewHoverEnter
Properties:

View hover exit - represents the event of stopping to hover over a View. The hover may be generated via exploring the screen by touch or via a pointing device.
Type:AccessibilityEventCompat.TypeViewHoverExit
Properties:
Touch interaction start - represents the event of starting a touch interaction, which is the user starts touching the screen.

Type:AccessibilityEventCompat.TypeTouchInteractionStart
Properties:

Note: This event is fired only by the system and is not passed to the view tree to be populated.
Touch interaction end - represents the event of ending a touch interaction, which is the user stops touching the screen.

Type:AccessibilityEventCompat.TypeTouchInteractionEnd
Properties:

Note: This event is fired only by the system and is not passed to the view tree to be populated.
Touch exploration gesture start - represents the event of starting a touch exploring gesture.

Type:EventTypes.TouchExplorationGestureStart
Properties:

Note: This event is fired only by the system and is not passed to the view tree to be populated.
Touch exploration gesture end - represents the event of ending a touch exploring gesture.

Type:EventTypes.TouchExplorationGestureEnd
Properties:

Note: This event is fired only by the system and is not passed to the view tree to be populated.
Touch gesture detection start - represents the event of starting a user gesture detection.

Type:AccessibilityEventCompat.TypeGestureDetectionStart
Properties:

Note: This event is fired only by the system and is not passed to the view tree to be populated.
Touch gesture detection end - represents the event of ending a user gesture detection.

Type:AccessibilityEventCompat.TypeGestureDetectionEnd
Properties:

Note: This event is fired only by the system and is not passed to the view tree to be populated.
MISCELLANEOUS TYPES

Announcement - represents the event of an application making an announcement. Usually this announcement is related to some sort of a context change for which none of the events representing UI transitions is a good fit. For example, announcing a new page in a book.
Type:AccessibilityEventCompat.TypeAnnouncement
Properties:

Security note

Since an event contains the text of its source privacy can be compromised by leaking sensitive information such as passwords. To address this issue any event fired in response to manipulation of a PASSWORD field does NOT CONTAIN the text of the password.

See Also

[Android Documentation]

Requirements

Namespace: Android.Views.Accessibility
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 4

The members of Android.Views.Accessibility.AccessibilityEvent are listed below.

See Also: AccessibilityRecord

Public Fields

const
ContentChangeTypeContentDescriptionContentChangeTypes (4). Change type for AccessibilityEventCompat.TypeWindowContentChanged event: The node's content description changed.
const
ContentChangeTypeSubtreeContentChangeTypes (1). Change type for AccessibilityEventCompat.TypeWindowContentChanged event: A node in the subtree rooted at the source node was added or removed.
const
ContentChangeTypeTextContentChangeTypes (2). Change type for AccessibilityEventCompat.TypeWindowContentChanged event: The node's text changed.
const
ContentChangeTypeUndefinedContentChangeTypes (0). Change type for AccessibilityEventCompat.TypeWindowContentChanged event: The type of change is not defined.
const
InvalidPositionInt32 (-1). Invalid selection/focus position.
const
MaxTextLengthInt32 (500). Maximum length of the text fields.

Public Properties

ActionGlobalAction. Gets the performed action that triggered this event.
override
AddedCountInt32.
override
BeforeTextFormattedICharSequence.
override
CheckedBoolean.
override
ClassNameFormattedICharSequence.
ContentChangeTypesContentChangeTypes. Gets the bit mask of change types signaled by an AccessibilityEventCompat.TypeWindowContentChanged event.
override
ContentDescriptionFormattedICharSequence.
[read-only]
static
CreatorIParcelableCreator.
override
CurrentItemIndexInt32.
override
EnabledBoolean.
EventTimeInt64. Gets the time in which this event was sent.
EventTypeEventTypes. Gets the event type.
override
FromIndexInt32.
override
FullScreenBoolean.
override
ItemCountInt32.
MovementGranularityMovementGranularity. Gets the movement granularity that was traversed.
PackageNameString.
PackageNameFormattedICharSequence. Gets the package name of the source.
override
ParcelableDataIParcelable.
override
PasswordBoolean.
[read-only]
RecordCountInt32. Gets the number of records contained in the event.
override
RemovedCountInt32.
[read-only]
override
TextIList<Java.Lang.ICharSequence>.

Protected Properties

[read-only]
override
ThresholdClassIntPtr. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.
[read-only]
override
ThresholdTypeType. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Public Methods

AppendRecord(AccessibilityRecord)
Appends an AccessibilityRecord to the end of event records.
DescribeContents() : Int32
Describe the kinds of special objects contained in this Parcelable's marshalled representation.
static
EventTypeToString(EventTypes) : String
Returns the string representation of an event type.
GetRecord(Int32) : AccessibilityRecord
Gets the record at a given index.
InitFromParcel(Parcel)
Creates a new instance from a Parcel.
static
Obtain() : AccessibilityEvent
Returns a cached instance if such is available or a new one is instantiated.
static
Obtain(AccessibilityEvent) : AccessibilityEvent
Returns a cached instance if such is available or a new one is created.
static
Obtain(EventTypes) : AccessibilityEvent
Returns a cached instance if such is available or a new one is instantiated with its type property set.
override
Recycle()
Recycles an instance back to be reused.
WriteToParcel(Parcel, ParcelableWriteFlags)
Flatten this object in to a Parcel.