Skip to content

Most visited

Recently visited

navigation

AccessibilityRecordCompat

public class AccessibilityRecordCompat
extends Object

java.lang.Object
   ↳ android.support.v4.view.accessibility.AccessibilityRecordCompat


Helper for accessing AccessibilityRecord in a backwards compatible fashion.

Summary

Public constructors

AccessibilityRecordCompat(Object record)

This constructor was deprecated in API level 22.0.0. This is not type safe. If you want to modify an AccessibilityEvent's properties defined in AccessibilityRecord use asRecord(AccessibilityEvent). This method will be removed in a subsequent release of the support library.

Public methods

boolean equals(Object obj)

This method is deprecated. Use AccessibilityRecord directly.

int getAddedCount()

This method is deprecated. Use getAddedCount() directly.

CharSequence getBeforeText()

This method is deprecated. Use getBeforeText() directly.

CharSequence getClassName()

This method is deprecated. Use getClassName() directly.

CharSequence getContentDescription()

This method is deprecated. Use getContentDescription() directly.

int getCurrentItemIndex()

This method is deprecated. Use getCurrentItemIndex() directly.

int getFromIndex()

This method is deprecated. Use getFromIndex() directly.

Object getImpl()

This method was deprecated in API level 22.0.0. This method will be removed in a subsequent release of the support library.

int getItemCount()

This method is deprecated. Use getItemCount() directly.

int getMaxScrollX()

This method is deprecated. Use getMaxScrollX(AccessibilityRecord) instead.

static int getMaxScrollX(AccessibilityRecord record)

Gets the max scroll offset of the source left edge in pixels.

int getMaxScrollY()

This method is deprecated. Use getMaxScrollY(AccessibilityRecord) instead.

static int getMaxScrollY(AccessibilityRecord record)

Gets the max scroll offset of the source top edge in pixels.

Parcelable getParcelableData()

This method is deprecated. Use getParcelableData() directly.

int getRemovedCount()

This method is deprecated. Use getRemovedCount() directly.

int getScrollX()

This method is deprecated. Use getScrollX() directly.

int getScrollY()

This method is deprecated. Use getScrollY() directly.

AccessibilityNodeInfoCompat getSource()

This method is deprecated. Use getSource() directly.

List<CharSequence> getText()

This method is deprecated. Use getText() directly.

int getToIndex()

This method is deprecated. Use getToIndex() directly.

int getWindowId()

This method is deprecated. Use getWindowId() directly.

int hashCode()

This method is deprecated. Use hashCode() directly.

boolean isChecked()

This method is deprecated. Use isChecked() directly.

boolean isEnabled()

This method is deprecated. Use isEnabled() directly.

boolean isFullScreen()

This method is deprecated. Use isFullScreen() directly.

boolean isPassword()

This method is deprecated. Use isPassword() directly.

boolean isScrollable()

This method is deprecated. Use isScrollable() directly.

static AccessibilityRecordCompat obtain(AccessibilityRecordCompat record)

This method is deprecated. Use obtain(AccessibilityRecord) directly.

static AccessibilityRecordCompat obtain()

This method is deprecated. Use obtain() directly.

void recycle()

This method is deprecated. Use recycle() directly.

void setAddedCount(int addedCount)

This method is deprecated. Use setAddedCount(int) directly.

void setBeforeText(CharSequence beforeText)

This method is deprecated. Use setBeforeText(CharSequence) directly.

void setChecked(boolean isChecked)

This method is deprecated. Use setChecked(boolean) directly.

void setClassName(CharSequence className)

This method is deprecated. Use setClassName(CharSequence) directly.

void setContentDescription(CharSequence contentDescription)

This method is deprecated. Use setContentDescription(CharSequence) directly.

void setCurrentItemIndex(int currentItemIndex)

This method is deprecated. Use setCurrentItemIndex(int) directly.

void setEnabled(boolean isEnabled)

This method is deprecated. Use isEnabled() directly.

void setFromIndex(int fromIndex)

This method is deprecated. Use setFromIndex(int) directly.

void setFullScreen(boolean isFullScreen)

This method is deprecated. Use setFullScreen(boolean) directly.

void setItemCount(int itemCount)

This method is deprecated. Use setItemCount(int) directly.

void setMaxScrollX(int maxScrollX)

This method is deprecated. Use setMaxScrollX(AccessibilityRecord, int) instead.

static void setMaxScrollX(AccessibilityRecord record, int maxScrollX)

Sets the max scroll offset of the source left edge in pixels.

static void setMaxScrollY(AccessibilityRecord record, int maxScrollY)

Sets the max scroll offset of the source top edge in pixels.

void setMaxScrollY(int maxScrollY)

This method is deprecated. Use setMaxScrollY(AccessibilityRecord, int) instead.

void setParcelableData(Parcelable parcelableData)

This method is deprecated. Use setParcelableData(Parcelable) directly.

void setPassword(boolean isPassword)

This method is deprecated. Use setPassword(boolean) directly.

void setRemovedCount(int removedCount)

This method is deprecated. Use setRemovedCount(int) directly.

void setScrollX(int scrollX)

This method is deprecated. Use setScrollX(int) directly.

void setScrollY(int scrollY)

This method is deprecated. Use setScrollY(int) directly.

void setScrollable(boolean scrollable)

This method is deprecated. Use setScrollable(boolean) directly.

void setSource(View root, int virtualDescendantId)

This method is deprecated. Use setSource(AccessibilityRecord, View, int) instead.

void setSource(View source)

This method is deprecated. Use setSource(View) directly.

static void setSource(AccessibilityRecord record, View root, int virtualDescendantId)

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

void setToIndex(int toIndex)

This method is deprecated. Use setToIndex(int) directly.

Inherited methods

From class java.lang.Object

Public constructors

AccessibilityRecordCompat

added in version 22.0.0
AccessibilityRecordCompat (Object record)

This constructor was deprecated in API level 22.0.0.
This is not type safe. If you want to modify an AccessibilityEvent's properties defined in AccessibilityRecord use asRecord(AccessibilityEvent). This method will be removed in a subsequent release of the support library.

Parameters
record Object

Public methods

equals

boolean equals (Object obj)

This method is deprecated.
Use AccessibilityRecord directly.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

The equals method for class Object implements the most discriminating possible equivalence relation on objects; that is, for any non-null reference values x and y, this method returns true if and only if x and y refer to the same object (x == y has the value true).

Note that it is generally necessary to override the hashCode method whenever this method is overridden, so as to maintain the general contract for the hashCode method, which states that equal objects must have equal hash codes.

Parameters
obj Object: the reference object with which to compare.
Returns
boolean true if this object is the same as the obj argument; false otherwise.

getAddedCount

added in version 22.0.0
int getAddedCount ()

This method is deprecated.
Use getAddedCount() directly.

Gets the number of added characters.

Returns
int The number of added characters.

getBeforeText

added in version 22.0.0
CharSequence getBeforeText ()

This method is deprecated.
Use getBeforeText() directly.

Sets the text before a change.

Returns
CharSequence The text before the change.

getClassName

added in version 22.0.0
CharSequence getClassName ()

This method is deprecated.
Use getClassName() directly.

Gets the class name of the source.

Returns
CharSequence The class name.

getContentDescription

added in version 22.0.0
CharSequence getContentDescription ()

This method is deprecated.
Use getContentDescription() directly.

Gets the description of the source.

Returns
CharSequence The description.

getCurrentItemIndex

added in version 22.0.0
int getCurrentItemIndex ()

This method is deprecated.
Use getCurrentItemIndex() directly.

Gets the index of the source in the list of items the can be visited.

Returns
int The current item index.

getFromIndex

added in version 22.0.0
int getFromIndex ()

This method is deprecated.
Use getFromIndex() directly.

Gets the index of the first character of the changed sequence, or the beginning of a text selection or the index of the first visible item when scrolling.

Returns
int The index of the first character or selection start or the first visible item.

getImpl

added in version 22.0.0
Object getImpl ()

This method was deprecated in API level 22.0.0.
This method will be removed in a subsequent release of the support library.

Returns
Object The wrapped implementation.

getItemCount

added in version 22.0.0
int getItemCount ()

This method is deprecated.
Use getItemCount() directly.

Gets the number of items that can be visited.

Returns
int The number of items.

getMaxScrollX

added in version 22.0.0
int getMaxScrollX ()

This method is deprecated.
Use getMaxScrollX(AccessibilityRecord) instead.

Gets the max scroll offset of the source left edge in pixels.

Returns
int The max scroll.

getMaxScrollX

int getMaxScrollX (AccessibilityRecord record)

Gets the max scroll offset of the source left edge in pixels.

Parameters
record AccessibilityRecord: The AccessibilityRecord instance to use.
Returns
int The max scroll.

getMaxScrollY

added in version 22.0.0
int getMaxScrollY ()

This method is deprecated.
Use getMaxScrollY(AccessibilityRecord) instead.

Gets the max scroll offset of the source top edge in pixels.

Returns
int The max scroll.

getMaxScrollY

int getMaxScrollY (AccessibilityRecord record)

Gets the max scroll offset of the source top edge in pixels.

Parameters
record AccessibilityRecord: The AccessibilityRecord instance to use.
Returns
int The max scroll.

getParcelableData

added in version 22.0.0
Parcelable getParcelableData ()

This method is deprecated.
Use getParcelableData() directly.

Gets the Parcelable data.

Returns
Parcelable The parcelable data.

getRemovedCount

added in version 22.0.0
int getRemovedCount ()

This method is deprecated.
Use getRemovedCount() directly.

Gets the number of removed characters.

Returns
int The number of removed characters.

getScrollX

added in version 22.0.0
int getScrollX ()

This method is deprecated.
Use getScrollX() directly.

Gets the scroll offset of the source left edge in pixels.

Returns
int The scroll.

getScrollY

added in version 22.0.0
int getScrollY ()

This method is deprecated.
Use getScrollY() directly.

Gets the scroll offset of the source top edge in pixels.

Returns
int The scroll.

getSource

added in version 22.0.0
AccessibilityNodeInfoCompat getSource ()

This method is deprecated.
Use getSource() directly.

Gets the AccessibilityNodeInfo of the event source.

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

Returns
AccessibilityNodeInfoCompat The info of the source.

getText

added in version 22.0.0
List<CharSequence> getText ()

This method is deprecated.
Use getText() directly.

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.

Returns
List<CharSequence> The text.

getToIndex

added in version 22.0.0
int getToIndex ()

This method is deprecated.
Use getToIndex() directly.

Gets the index of text selection end or the index of the last visible item when scrolling.

Returns
int The index of selection end or last item index.

getWindowId

added in version 22.0.0
int getWindowId ()

This method is deprecated.
Use getWindowId() directly.

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

Returns
int The window id.

hashCode

int hashCode ()

This method is deprecated.
Use hashCode() directly.

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals(Object) method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals(java.lang.Object) method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.

As much as is reasonably practical, the hashCode method defined by class Object does return distinct integers for distinct objects. (This is typically implemented by converting the internal address of the object into an integer, but this implementation technique is not required by the Java™ programming language.)

Returns
int a hash code value for this object.

isChecked

added in version 22.0.0
boolean isChecked ()

This method is deprecated.
Use isChecked() directly.

Gets if the source is checked.

Returns
boolean True if the view is checked, false otherwise.

isEnabled

added in version 22.0.0
boolean isEnabled ()

This method is deprecated.
Use isEnabled() directly.

Gets if the source is enabled.

Returns
boolean True if the view is enabled, false otherwise.

isFullScreen

added in version 22.0.0
boolean isFullScreen ()

This method is deprecated.
Use isFullScreen() directly.

Gets if the source is taking the entire screen.

Returns
boolean True if the source is full screen, false otherwise.

isPassword

added in version 22.0.0
boolean isPassword ()

This method is deprecated.
Use isPassword() directly.

Gets if the source is a password field.

Returns
boolean True if the view is a password field, false otherwise.

isScrollable

added in version 22.0.0
boolean isScrollable ()

This method is deprecated.
Use isScrollable() directly.

Gets if the source is scrollable.

Returns
boolean True if the source is scrollable, false otherwise.

obtain

added in version 22.0.0
AccessibilityRecordCompat obtain (AccessibilityRecordCompat record)

This method is deprecated.
Use obtain(AccessibilityRecord) directly.

Returns a cached instance if such is available or a new one is instantiated. The instance is initialized with data from the given record.

Parameters
record AccessibilityRecordCompat
Returns
AccessibilityRecordCompat An instance.

obtain

added in version 22.0.0
AccessibilityRecordCompat obtain ()

This method is deprecated.
Use obtain() directly.

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

Returns
AccessibilityRecordCompat An instance.

recycle

added in version 22.0.0
void recycle ()

This method is deprecated.
Use recycle() directly.

Return an instance back to be reused.

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

Throws
IllegalStateException If the record is already recycled.

setAddedCount

added in version 22.0.0
void setAddedCount (int addedCount)

This method is deprecated.
Use setAddedCount(int) directly.

Sets the number of added characters.

Parameters
addedCount int: The number of added characters.
Throws
IllegalStateException If called from an AccessibilityService.

setBeforeText

added in version 22.0.0
void setBeforeText (CharSequence beforeText)

This method is deprecated.
Use setBeforeText(CharSequence) directly.

Sets the text before a change.

Parameters
beforeText CharSequence: The text before the change.
Throws
IllegalStateException If called from an AccessibilityService.

setChecked

added in version 22.0.0
void setChecked (boolean isChecked)

This method is deprecated.
Use setChecked(boolean) directly.

Sets if the source is checked.

Parameters
isChecked boolean: True if the view is checked, false otherwise.
Throws
IllegalStateException If called from an AccessibilityService.

setClassName

added in version 22.0.0
void setClassName (CharSequence className)

This method is deprecated.
Use setClassName(CharSequence) directly.

Sets the class name of the source.

Parameters
className CharSequence: The lass name.
Throws
IllegalStateException If called from an AccessibilityService.

setContentDescription

added in version 22.0.0
void setContentDescription (CharSequence contentDescription)

This method is deprecated.
Use setContentDescription(CharSequence) directly.

Sets the description of the source.

Parameters
contentDescription CharSequence: The description.
Throws
IllegalStateException If called from an AccessibilityService.

setCurrentItemIndex

added in version 22.0.0
void setCurrentItemIndex (int currentItemIndex)

This method is deprecated.
Use setCurrentItemIndex(int) directly.

Sets the index of the source in the list of items that can be visited.

Parameters
currentItemIndex int: The current item index.
Throws
IllegalStateException If called from an AccessibilityService.

setEnabled

added in version 22.0.0
void setEnabled (boolean isEnabled)

This method is deprecated.
Use isEnabled() directly.

Sets if the source is enabled.

Parameters
isEnabled boolean: True if the view is enabled, false otherwise.
Throws
IllegalStateException If called from an AccessibilityService.

setFromIndex

added in version 22.0.0
void setFromIndex (int fromIndex)

This method is deprecated.
Use setFromIndex(int) directly.

Sets the index of the first character of the changed sequence or the beginning of a text selection or the index of the first visible item when scrolling.

Parameters
fromIndex int: The index of the first character or selection start or the first visible item.
Throws
IllegalStateException If called from an AccessibilityService.

setFullScreen

added in version 22.0.0
void setFullScreen (boolean isFullScreen)

This method is deprecated.
Use setFullScreen(boolean) directly.

Sets if the source is taking the entire screen.

Parameters
isFullScreen boolean: True if the source is full screen, false otherwise.
Throws
IllegalStateException If called from an AccessibilityService.

setItemCount

added in version 22.0.0
void setItemCount (int itemCount)

This method is deprecated.
Use setItemCount(int) directly.

Sets the number of items that can be visited.

Parameters
itemCount int: The number of items.
Throws
IllegalStateException If called from an AccessibilityService.

setMaxScrollX

added in version 22.0.0
void setMaxScrollX (int maxScrollX)

This method is deprecated.
Use setMaxScrollX(AccessibilityRecord, int) instead.

Sets the max scroll offset of the source left edge in pixels.

Parameters
maxScrollX int: The max scroll.

setMaxScrollX

void setMaxScrollX (AccessibilityRecord record, 
                int maxScrollX)

Sets the max scroll offset of the source left edge in pixels.

Parameters
record AccessibilityRecord: The AccessibilityRecord instance to use.
maxScrollX int: The max scroll.

setMaxScrollY

void setMaxScrollY (AccessibilityRecord record, 
                int maxScrollY)

Sets the max scroll offset of the source top edge in pixels.

Parameters
record AccessibilityRecord: The AccessibilityRecord instance to use.
maxScrollY int: The max scroll.

setMaxScrollY

added in version 22.0.0
void setMaxScrollY (int maxScrollY)

This method is deprecated.
Use setMaxScrollY(AccessibilityRecord, int) instead.

Sets the max scroll offset of the source top edge in pixels.

Parameters
maxScrollY int: The max scroll.

setParcelableData

added in version 22.0.0
void setParcelableData (Parcelable parcelableData)

This method is deprecated.
Use setParcelableData(Parcelable) directly.

Sets the Parcelable data of the event.

Parameters
parcelableData Parcelable: The parcelable data.
Throws
IllegalStateException If called from an AccessibilityService.

setPassword

added in version 22.0.0
void setPassword (boolean isPassword)

This method is deprecated.
Use setPassword(boolean) directly.

Sets if the source is a password field.

Parameters
isPassword boolean: True if the view is a password field, false otherwise.
Throws
IllegalStateException If called from an AccessibilityService.

setRemovedCount

added in version 22.0.0
void setRemovedCount (int removedCount)

This method is deprecated.
Use setRemovedCount(int) directly.

Sets the number of removed characters.

Parameters
removedCount int: The number of removed characters.
Throws
IllegalStateException If called from an AccessibilityService.

setScrollX

added in version 22.0.0
void setScrollX (int scrollX)

This method is deprecated.
Use setScrollX(int) directly.

Sets the scroll offset of the source left edge in pixels.

Parameters
scrollX int: The scroll.

setScrollY

added in version 22.0.0
void setScrollY (int scrollY)

This method is deprecated.
Use setScrollY(int) directly.

Sets the scroll offset of the source top edge in pixels.

Parameters
scrollY int: The scroll.

setScrollable

added in version 22.0.0
void setScrollable (boolean scrollable)

This method is deprecated.
Use setScrollable(boolean) directly.

Sets if the source is scrollable.

Parameters
scrollable boolean: True if the source is scrollable, false otherwise.
Throws
IllegalStateException If called from an AccessibilityService.

setSource

added in version 22.0.0
void setSource (View root, 
                int virtualDescendantId)

This method is deprecated.
Use setSource(AccessibilityRecord, View, int) instead.

Sets the source to be a virtual descendant of the given root. If virtualDescendantId equals to 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 them selves as a tree of virtual views, thus conveying their logical structure.

Parameters
root View: The root of the virtual subtree.
virtualDescendantId int: The id of the virtual descendant.

setSource

added in version 22.0.0
void setSource (View source)

This method is deprecated.
Use setSource(View) directly.

Sets the event source.

Parameters
source View: The source.
Throws
IllegalStateException If called from an AccessibilityService.

setSource

void setSource (AccessibilityRecord record, 
                View root, 
                int virtualDescendantId)

Sets the source to be a virtual descendant of the given root. If virtualDescendantId equals to 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 them selves as a tree of virtual views, thus conveying their logical structure.

Parameters
record AccessibilityRecord: The AccessibilityRecord instance to use.
root View: The root of the virtual subtree.
virtualDescendantId int: The id of the virtual descendant.

setToIndex

added in version 22.0.0
void setToIndex (int toIndex)

This method is deprecated.
Use setToIndex(int) directly.

Sets the index of text selection end or the index of the last visible item when scrolling.

Parameters
toIndex int: The index of selection end or last item index.
This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a one-minute survey?
Help us improve Android tools and documentation.