Code example for AccessibilityNodeInfo

Methods: addAction, setAccessibilityFocused, setCheckable, setChecked, setClickable, setEnabled, setFocusable, setFocused, setPassword, setScrollable

0
    @CalledByNative 
    private void setAccessibilityNodeInfoBooleanAttributes(AccessibilityNodeInfo node,
            int virtualViewId, boolean checkable, boolean checked, boolean clickable,
            boolean enabled, boolean focusable, boolean focused, boolean password,
            boolean scrollable, boolean selected, boolean visibleToUser) {
        node.setCheckable(checkable);
        node.setChecked(checked);
        node.setClickable(clickable);
        node.setEnabled(enabled);
        node.setFocusable(focusable);
        node.setFocused(focused);
        node.setPassword(password);
        node.setScrollable(scrollable);
        node.setSelected(selected);
        node.setVisibleToUser(visibleToUser);
 
        if (focusable) {
            if (focused) {
                node.addAction(AccessibilityNodeInfo.ACTION_CLEAR_FOCUS);
            } else { 
                node.addAction(AccessibilityNodeInfo.ACTION_FOCUS);
            } 
        } 
 
        if (mAccessibilityFocusId == virtualViewId) {
            node.setAccessibilityFocused(true);
            node.addAction(AccessibilityNodeInfo.ACTION_CLEAR_ACCESSIBILITY_FOCUS);
        } else { 
            node.setAccessibilityFocused(false);
            node.addAction(AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS);
        } 
 
        if (clickable) {
            node.addAction(AccessibilityNodeInfo.ACTION_CLICK);
        } 
    } 
 
    @CalledByNative 
    private void setAccessibilityNodeInfoStringAttributes(AccessibilityNodeInfo node,