Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can a fragment announce itself on launch in Android Talkback?

I want Fragment to announce itself on launch in Android Talkback. Activity does announce itself when added 'android:label' on the activity tag in AndroidManifest file. How can I do that for Fragment?

like image 712
Yogesh Rathod Avatar asked Sep 27 '16 12:09

Yogesh Rathod


1 Answers

You can use one of the Fragment lifecycle methods to announce it yourself.

Fragments don't have an intrinsic title, and since they're basically Views + logic, it seems reasonable that the system can't predict when it would be appropriate to announce a newly added Fragment.

Something like overriding onCreateView(View view, ...) and then calling view.announceForAccessibility("title of my fragment") would work.

like image 113
ataulm Avatar answered Oct 12 '22 06:10

ataulm