Android APIs
public static final class

AccessibilityNodeInfo.AccessibilityAction

extends Object
java.lang.Object
   ↳ android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction

Class Overview

A class defining an action that can be performed on an AccessibilityNodeInfo. Each action has a unique id that is mandatory and optional data.

There are three categories of actions:

  • Standard actions - These are actions that are reported and handled by the standard UI widgets in the platform. For each standard action there is a static constant defined in this class, e.g. ACTION_FOCUS.
  • Custom actions action - These are actions that are reported and handled by custom widgets. i.e. ones that are not part of the UI toolkit. For example, an application may define a custom action for clearing the user history.
  • Overriden standard actions - These are actions that override standard actions to customize them. For example, an app may add a label to the standard click action to announce that this action clears browsing history.

Summary

Fields
public static final AccessibilityNodeInfo.AccessibilityAction ACTION_ACCESSIBILITY_FOCUS Action that gives accessibility focus to the node.
public static final AccessibilityNodeInfo.AccessibilityAction ACTION_CLEAR_ACCESSIBILITY_FOCUS Action that clears accessibility focus of the node.
public static final AccessibilityNodeInfo.AccessibilityAction ACTION_CLEAR_FOCUS Action that clears input focus of the node.
public static final AccessibilityNodeInfo.AccessibilityAction ACTION_CLEAR_SELECTION Action that deselects the node.
public static final AccessibilityNodeInfo.AccessibilityAction ACTION_CLICK Action that clicks on the node info.
public static final AccessibilityNodeInfo.AccessibilityAction ACTION_COLLAPSE Action to collapse an expandable node.
public static final AccessibilityNodeInfo.AccessibilityAction ACTION_COPY Action to copy the current selection to the clipboard.
public static final AccessibilityNodeInfo.AccessibilityAction ACTION_CUT Action to cut the current selection and place it to the clipboard.
public static final AccessibilityNodeInfo.AccessibilityAction ACTION_DISMISS Action to dismiss a dismissable node.
public static final AccessibilityNodeInfo.AccessibilityAction ACTION_EXPAND Action to expand an expandable node.
public static final AccessibilityNodeInfo.AccessibilityAction ACTION_FOCUS Action that gives input focus to the node.
public static final AccessibilityNodeInfo.AccessibilityAction ACTION_LONG_CLICK Action that long clicks on the node.
public static final AccessibilityNodeInfo.AccessibilityAction ACTION_NEXT_AT_MOVEMENT_GRANULARITY Action that requests to go to the next entity in this node's text at a given movement granularity.
public static final AccessibilityNodeInfo.AccessibilityAction ACTION_NEXT_HTML_ELEMENT Action to move to the next HTML element of a given type.
public static final AccessibilityNodeInfo.AccessibilityAction ACTION_PASTE Action to paste the current clipboard content.
public static final AccessibilityNodeInfo.AccessibilityAction ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY Action that requests to go to the previous entity in this node's text at a given movement granularity.
public static final AccessibilityNodeInfo.AccessibilityAction ACTION_PREVIOUS_HTML_ELEMENT Action to move to the previous HTML element of a given type.
public static final AccessibilityNodeInfo.AccessibilityAction ACTION_SCROLL_BACKWARD Action to scroll the node content backward.
public static final AccessibilityNodeInfo.AccessibilityAction ACTION_SCROLL_FORWARD Action to scroll the node content forward.
public static final AccessibilityNodeInfo.AccessibilityAction ACTION_SELECT Action that selects the node.
public static final AccessibilityNodeInfo.AccessibilityAction ACTION_SET_SELECTION Action to set the selection.
public static final AccessibilityNodeInfo.AccessibilityAction ACTION_SET_TEXT Action that sets the text of the node.
Public Constructors
AccessibilityNodeInfo.AccessibilityAction(int actionId, CharSequence label)
Creates a new AccessibilityAction.
Public Methods
boolean equals(Object other)
Compares this instance with the specified object and indicates if they are equal.
int getId()
Gets the id for this action.
CharSequence getLabel()
Gets the label for this action.
int hashCode()
Returns an integer hash code for this object.
String toString()
Returns a string containing a concise, human-readable description of this object.
[Expand]
Inherited Methods
From class java.lang.Object

Fields

public static final AccessibilityNodeInfo.AccessibilityAction ACTION_ACCESSIBILITY_FOCUS

Added in API level 21

Action that gives accessibility focus to the node.

public static final AccessibilityNodeInfo.AccessibilityAction ACTION_CLEAR_ACCESSIBILITY_FOCUS

Added in API level 21

Action that clears accessibility focus of the node.

public static final AccessibilityNodeInfo.AccessibilityAction ACTION_CLEAR_FOCUS

Added in API level 21

Action that clears input focus of the node.

public static final AccessibilityNodeInfo.AccessibilityAction ACTION_CLEAR_SELECTION

Added in API level 21

Action that deselects the node.

public static final AccessibilityNodeInfo.AccessibilityAction ACTION_CLICK

Added in API level 21

Action that clicks on the node info.

public static final AccessibilityNodeInfo.AccessibilityAction ACTION_COLLAPSE

Added in API level 21

Action to collapse an expandable node.

public static final AccessibilityNodeInfo.AccessibilityAction ACTION_COPY

Added in API level 21

Action to copy the current selection to the clipboard.

public static final AccessibilityNodeInfo.AccessibilityAction ACTION_CUT

Added in API level 21

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

public static final AccessibilityNodeInfo.AccessibilityAction ACTION_DISMISS

Added in API level 21

Action to dismiss a dismissable node.

public static final AccessibilityNodeInfo.AccessibilityAction ACTION_EXPAND

Added in API level 21

Action to expand an expandable node.

public static final AccessibilityNodeInfo.AccessibilityAction ACTION_FOCUS

Added in API level 21

Action that gives input focus to the node.

public static final AccessibilityNodeInfo.AccessibilityAction ACTION_LONG_CLICK

Added in API level 21

Action that long clicks on the node.

public static final AccessibilityNodeInfo.AccessibilityAction ACTION_NEXT_AT_MOVEMENT_GRANULARITY

Added in API level 21

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: AccessibilityNodeInfo.ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT, AccessibilityNodeInfo.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(AccessibilityAction.ACTION_NEXT_AT_MOVEMENT_GRANULARITY.getId(), arguments);

public static final AccessibilityNodeInfo.AccessibilityAction ACTION_NEXT_HTML_ELEMENT

Added in API level 21

Action to move to the next HTML element of a given type. For example, move to the BUTTON, INPUT, TABLE, etc.

Arguments: AccessibilityNodeInfo.ACTION_ARGUMENT_HTML_ELEMENT_STRING
Example:

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

public static final AccessibilityNodeInfo.AccessibilityAction ACTION_PASTE

Added in API level 21

Action to paste the current clipboard content.

public static final AccessibilityNodeInfo.AccessibilityAction ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY

Added in API level 21

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: AccessibilityNodeInfo.ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT, AccessibilityNodeInfo.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(AccessibilityAction.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY.getId(), arguments);

public static final AccessibilityNodeInfo.AccessibilityAction ACTION_PREVIOUS_HTML_ELEMENT

Added in API level 21

Action to move to the previous HTML element of a given type. For example, move to the BUTTON, INPUT, TABLE, etc.

Arguments: AccessibilityNodeInfo.ACTION_ARGUMENT_HTML_ELEMENT_STRING
Example:

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

public static final AccessibilityNodeInfo.AccessibilityAction ACTION_SCROLL_BACKWARD

Added in API level 21

Action to scroll the node content backward.

public static final AccessibilityNodeInfo.AccessibilityAction ACTION_SCROLL_FORWARD

Added in API level 21

Action to scroll the node content forward.

public static final AccessibilityNodeInfo.AccessibilityAction ACTION_SELECT

Added in API level 21

Action that selects the node.

public static final AccessibilityNodeInfo.AccessibilityAction ACTION_SET_SELECTION

Added in API level 21

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

Arguments: AccessibilityNodeInfo.ACTION_ARGUMENT_SELECTION_START_INT, AccessibilityNodeInfo.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(AccessibilityAction.ACTION_SET_SELECTION.getId(), arguments);

public static final AccessibilityNodeInfo.AccessibilityAction ACTION_SET_TEXT

Added in API level 21

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: AccessibilityNodeInfo.ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE
Example:

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

Public Constructors

public AccessibilityNodeInfo.AccessibilityAction (int actionId, CharSequence label)

Added in API level 21

Creates a new AccessibilityAction. For adding a standard action without a specific label, use the static constants. You can also override the description for one the standard actions. Below is an example how to override the standard click action by adding a custom label:

   AccessibilityAction action = new AccessibilityAction(
           AccessibilityAction.ACTION_ACTION_CLICK, getLocalizedLabel());
   node.addAction(action);
 

Parameters
actionId The id for this action. This should either be one of the standard actions or a specific action for your app. In that case it is required to use a resource identifier.
label The label for the new AccessibilityAction.

Public Methods

public boolean equals (Object other)

Added in API level 21

Compares this instance with the specified object and indicates if they are equal. In order to be equal, o must represent the same object as this instance using a class-specific comparison. The general contract is that this comparison should be reflexive, symmetric, and transitive. Also, no object reference other than null is equal to null.

The default implementation returns true only if this == o. See Writing a correct equals method if you intend implementing your own equals method.

The general contract for the equals and hashCode() methods is that if equals returns true for any two objects, then hashCode() must return the same value for these objects. This means that subclasses of Object usually override either both methods or neither of them.

Parameters
other the object to compare this instance with.
Returns
  • true if the specified object is equal to this Object; false otherwise.

public int getId ()

Added in API level 21

Gets the id for this action.

Returns
  • The action id.

public CharSequence getLabel ()

Added in API level 21

Gets the label for this action. Its purpose is to describe the action to user.

Returns
  • The label.

public int hashCode ()

Added in API level 21

Returns an integer hash code for this object. By contract, any two objects for which equals(Object) returns true must return the same hash code value. This means that subclasses of Object usually override both methods or neither method.

Note that hash values must not change over time unless information used in equals comparisons also changes.

See Writing a correct hashCode method if you intend implementing your own hashCode method.

Returns
  • this object's hash code.

public String toString ()

Added in API level 21

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 is equivalent to the following expression:

   getClass().getName() + '@' + Integer.toHexString(hashCode())

See Writing a useful toString method if you intend implementing your own toString method.

Returns
  • a printable representation of this object.