Reputation: 604
On some user action, I want to make some announcement
on the screen and soon after, I want to shift accessibility focus on the specifc view
.
I can achieve it like,
view!!.announceForAccessibility("some action failed.")
Handler().postDelayed({
specificView.requestFocus()
specificView.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_FOCUSED)
}, 1000)
But this is just a workaround. It may fail in some case when a user has customized speaking rate
etc.
Is there any way where we can get a callback when talkback finish with reading announcement?
Upvotes: 5
Views: 1653
Reputation: 26
I'm not sure if it's a correct solution or not but this worked for me.
specificView.contentDescriotion = "text you need to annonce"
specificView.requestFocus()
specificView.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_FOCUSED)
Handler().postDelayed({
specificView.contentDescriotion = "actual content description for that view"
}, 300)
Making an announcement to the content description for a view that you want to focus.
Upvotes: 0