java.lang.Object | |
↳ | android.view.accessibility.AccessibilityEvent |
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.
This class represents various semantically different accessibility event types. Each event type has associated a 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. Since some event types are semantically close there are mask constants that group them together. Follows a specification of the event types and their associated properties:
VIEW TYPES
View clicked - represents the event of clicking on a View
like Button, CompoundButton, etc.
Type:TYPE_VIEW_CLICKED
Properties:
getClassName(),
getPackageName(),
getEventTime(),
getText(),
isChecked(),
isEnabled(),
isPassword(),
getItemCount(),
getCurrentItemIndex()
View long clicked - represents the event of long clicking on a View
like Button, CompoundButton, etc.
Type:TYPE_VIEW_LONG_CLICKED
Properties:
getClassName(),
getPackageName(),
getEventTime(),
getText(),
isChecked(),
isEnabled(),
isPassword(),
getItemCount(),
getCurrentItemIndex()
View selected - represents the event of selecting an item usually in
the context of an AdapterView.
Type: TYPE_VIEW_SELECTED
Properties:
getClassName(),
getPackageName(),
getEventTime(),
getText(),
isChecked(),
isEnabled(),
isPassword(),
getItemCount(),
getCurrentItemIndex()
View focused - represents the event of focusing a
View.
Type: TYPE_VIEW_FOCUSED
Properties:
getClassName(),
getPackageName(),
getEventTime(),
getText(),
isChecked(),
isEnabled(),
isPassword(),
getItemCount(),
getCurrentItemIndex()
View text changed - represents the event of changing the text of an
EditText.
Type: TYPE_VIEW_TEXT_CHANGED
Properties:
getClassName(),
getPackageName(),
getEventTime(),
getText(),
isChecked(),
isEnabled(),
isPassword(),
getItemCount(),
getCurrentItemIndex(),
getFromIndex(),
getAddedCount(),
getRemovedCount(),
getBeforeText()
TRANSITION TYPES
Window state changed - represents the event of opening/closing a
PopupWindow, Menu,
Dialog, etc.
Type: TYPE_WINDOW_STATE_CHANGED
Properties:
getClassName(),
getPackageName(),
getEventTime(),
getText()
NOTIFICATION TYPES
Notification state changed - represents the event showing/hiding
Notification.
Type: TYPE_NOTIFICATION_STATE_CHANGED
Properties:
getClassName(),
getPackageName(),
getEventTime(),
getText()
getParcelableData()
Security note
Since an event contains the text of its source privacy can be compromised by leaking of 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.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creator<AccessibilityEvent> | CREATOR | ||||||||||
int | INVALID_POSITION | Invalid selection/focus position. | |||||||||
int | MAX_TEXT_LENGTH | Maximum length of the text fields. | |||||||||
int | TYPES_ALL_MASK | Mask for AccessibilityEvent all types. | |||||||||
int | TYPE_NOTIFICATION_STATE_CHANGED | Represents the event showing/hiding a Notification. | |||||||||
int | TYPE_VIEW_CLICKED | Represents the event of clicking on a View like Button, CompoundButton, etc. | |||||||||
int | TYPE_VIEW_FOCUSED | Represents the event of focusing a View. | |||||||||
int | TYPE_VIEW_LONG_CLICKED | Represents the event of long clicking on a View like Button, CompoundButton, etc. | |||||||||
int | TYPE_VIEW_SELECTED | Represents the event of selecting an item usually in the context of an AdapterView. | |||||||||
int | TYPE_VIEW_TEXT_CHANGED | Represents the event of changing the text of an EditText. | |||||||||
int | TYPE_WINDOW_STATE_CHANGED | Represents the event of opening/closing a PopupWindow, Menu, Dialog, etc. |
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From interface
android.os.Parcelable
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Describe the kinds of special objects contained in this Parcelable's
marshalled representation.
| |||||||||||
Gets the number of added characters.
| |||||||||||
Sets the text before a change.
| |||||||||||
Gets the class name of the source.
| |||||||||||
Gets the description of the source.
| |||||||||||
Gets the index of the source in the list of items the can be visited.
| |||||||||||
Gets the time in which this event was sent.
| |||||||||||
Gets the event type.
| |||||||||||
Gets the index of the first character of the changed sequence.
| |||||||||||
Gets the number of items that can be visited.
| |||||||||||
Gets the package name of the source.
| |||||||||||
Gets the Parcelable data.
| |||||||||||
Gets the number of removed characters.
| |||||||||||
Gets the text of the event.
| |||||||||||
Creates a new instance from a Parcel.
| |||||||||||
Gets if the source is checked.
| |||||||||||
Gets if the source is enabled.
| |||||||||||
Gets if the source is taking the entire screen.
| |||||||||||
Gets if the source is a password field.
| |||||||||||
Returns a cached instance if such is available or a new one is
instantiated.
| |||||||||||
Returns a cached instance if such is available or a new one is
instantiated with type property set.
| |||||||||||
Return an instance back to be reused.
| |||||||||||
Sets the number of added characters.
| |||||||||||
Sets the text before a change.
| |||||||||||
Sets if the source is checked.
| |||||||||||
Sets the class name of the source.
| |||||||||||
Sets the description of the source.
| |||||||||||
Sets the index of the source in the list of items that can be visited.
| |||||||||||
Sets if the source is enabled.
| |||||||||||
Sets the time in which this event was sent.
| |||||||||||
Sets the event type.
| |||||||||||
Sets the index of the first character of the changed sequence.
| |||||||||||
Sets if the source is taking the entire screen.
| |||||||||||
Sets the number of items that can be visited.
| |||||||||||
Sets the package name of the source.
| |||||||||||
Sets the Parcelable data of the event.
| |||||||||||
Sets if the source is a password field.
| |||||||||||
Sets the number of removed characters.
| |||||||||||
Returns a string containing a concise, human-readable description of this
object.
| |||||||||||
Flatten this object in to a Parcel.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class java.lang.Object
| |||||||||||
From interface android.os.Parcelable
|
Maximum length of the text fields.
Represents the event showing/hiding a Notification.
Represents the event of clicking on a View like Button, CompoundButton, etc.
Represents the event of focusing a View.
Represents the event of long clicking on a View like Button, CompoundButton, etc.
Represents the event of selecting an item usually in the context of an AdapterView.
Represents the event of changing the text of an EditText.
Represents the event of opening/closing a PopupWindow, Menu, Dialog, etc.
Describe the kinds of special objects contained in this Parcelable's marshalled representation.
Gets the number of added characters.
Sets the text before a change.
Gets the class name of the source.
Gets the description of the source.
Gets the index of the source in the list of items the can be visited.
Gets the time in which this event was sent.
Gets the index of the first character of the changed sequence.
Gets the number of items that can be visited.
Gets the package name of the source.
Gets the Parcelable data.
Gets the number of removed characters.
Gets the text of the event. The index in the list represents the priority of the text. Specifically, the lower the index the higher the priority.
Creates a new instance from a Parcel.
parcel | A parcel containing the state of a AccessibilityEvent. |
---|
Gets if the source is checked.
Gets if the source is enabled.
Gets if the source is taking the entire screen.
Gets if the source is a password field.
Returns a cached instance if such is available or a new one is instantiated.
Returns a cached instance if such is available or a new one is instantiated with type property set.
eventType | The event type. |
---|
Return an instance back to be reused.
Note: You must not touch the object after calling this function.
Sets the number of added characters.
addedCount | The number of added characters. |
---|
Sets the text before a change.
beforeText | The text before the change. |
---|
Sets if the source is checked.
isChecked | True if the view is checked, false otherwise. |
---|
Sets the class name of the source.
className | The lass name. |
---|
Sets the description of the source.
contentDescription | The description. |
---|
Sets the index of the source in the list of items that can be visited.
currentItemIndex | The current item index. |
---|
Sets if the source is enabled.
isEnabled | True if the view is enabled, false otherwise. |
---|
Sets the time in which this event was sent.
eventTime | The event time. |
---|
Sets the event type.
eventType | The event type. |
---|
Sets the index of the first character of the changed sequence.
fromIndex | The index of the first character. |
---|
Sets if the source is taking the entire screen.
isFullScreen | True if the source is full screen, false otherwise. |
---|
Sets the number of items that can be visited.
itemCount | The number of items. |
---|
Sets the package name of the source.
packageName | The package name. |
---|
Sets the Parcelable data of the event.
parcelableData | The parcelable data. |
---|
Sets if the source is a password field.
isPassword | True if the view is a password field, false otherwise. |
---|
Sets the number of removed characters.
removedCount | The number of removed characters. |
---|
Returns a string containing a concise, human-readable description of this object. Subclasses are encouraged to override this method and provide an implementation that takes into account the object's type and data. The default implementation simply concatenates the class name, the '@' sign and a hexadecimal representation of the object's hashCode(), that is, it is equivalent to the following expression:
getClass().getName() + '@' + Integer.toHexString(hashCode())
Flatten this object in to a Parcel.
parcel | The Parcel in which the object should be written. |
---|---|
flags | Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE. |