Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android accessibility talkback to say fragment's title

Is there a way to get the talkback function in Android accessibility to say something after a fragment transaction? I basically want the talkback to say the name/title of the fragment after switching. These titles are set as the titles of the action bar, can they be accessed there? A user can move their finger on top of the text in the action bar to know what screen they are on, but the user won't know that unless they were familiar with the app already.

like image 222
Jason Hu Avatar asked Nov 14 '13 20:11

Jason Hu


1 Answers

You can force a WINDOW_STATE_CHANGED event from the decor view to announce the ActionBar title. This will also cause TalkBack to clear accessibility focus, so you should only call it when the app's primary content changes.

getWindow().getDecorView()
        .sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED);
like image 165
alanv Avatar answered Sep 20 '22 17:09

alanv