'How to get rid of default contentDescription in android accessibility

I have a gridview with 5*5 image views that is custom defined. After I turn on the accessibility and focus on a image view, i would like it read the name of this image instead of "row 1 column 1". So i use imageView.setContentDescription(imageTitle);, it's working but it reads like "imageTitle, row 1 column 1".

How do I get rid of the "row 1 column 1" (which I suppose is the default one)?

Any help is appreciated!! Thanks in advance!



Solution 1:[1]

You should setAccessibilityDelegate to gridview, CollectionInfo and CollectionItemInfo are set to null. Talkback will read the name of your image item.

gridView.setAccessibilityDelegate(new AccessibilityDelegate () {
    @Override
        @Override
        public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfoCompat info) {
            super.onInitializeAccessibilityNodeInfo(host, info);
            info.setCollectionInfo(null);
            info.setCollectionItemInfo(null);
        }
    }
});

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Duc Phan Dinh