Skip to main content
Logo Appt Light

Accessibility action on Android

Accessibility actions provide alternative ways for users of assistive technologies to perform actions. For users of switch control it can be difficult to use drag-and-drop functionality. This functionality can be made more accessible by providing accessibility actions to move items up and down.

On Android, you can add actions for assistive technologies using the addAction method via AccessibilityNodeInfoCompat.

ViewCompat.setAccessibilityDelegate(view, new AccessibilityDelegateCompat() {
    @Override
    public void onInitializeAccessibilityNodeInfo(
        View host,
        AccessibilityNodeInfoCompat info)
    {
        super.onInitializeAccessibilityNodeInfo(host, info);
        AccessibilityActionCompat action = new AccessibilityActionCompat(
            AccessibilityNodeInfoCompat.ACTION_CLICK,
            "Appt action"
        );
        info.addAction(customClick);
    }
});

Feedback?

Let us know!