Accessibility live region on Android
A live region allows users of assistive technologies to receive updates whenever important information on the screen changes.
On Android, a live region can be set by using the convience method setAccessibilityLiveRegion
of ViewCompat
. To interrupt ingoing speech, also known as being assertive, use ACCESSIBILITY_LIVE_REGION_ASSERTIVE
. To wait for ongoing speech, also known as being polite, use ACCESSIBILITY_LIVE_REGION_POLITE
.
// Interrupt ongoing speech
ViewCompat.setAccessibilityLiveRegion(view, ViewCompat.ACCESSIBILITY_LIVE_REGION_ASSERTIVE)
// Wait for ongoing speech
ViewCompat.setAccessibilityLiveRegion(view, ViewCompat.ACCESSIBILITY_LIVE_REGION_POLITE)