Code example for AccessibilityEvent

Methods: setClassName, setCurrentItemIndex, setEnabled, setFromIndex, setItemCount, setScrollable, setToIndex

0
    } 
 
    @SuppressLint("NewApi") 
    @Override 
    public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
        super.onInitializeAccessibilityEvent(event);
        event.setClassName(AdapterView.class.getName());
        event.setScrollable(isScrollableForAccessibility());
        View selectedView = getSelectedView();
        if (selectedView != null) {
            event.setEnabled(selectedView.isEnabled());
        } 
        event.setCurrentItemIndex(getSelectedItemPosition());
        event.setFromIndex(getFirstVisiblePosition());
        event.setToIndex(getLastVisiblePosition());
        event.setItemCount(getCount());
    } 
 
    @SuppressLint("NewApi") 
    @Override 
    public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {