android - Talk Back accessibility, requesting focus on a TextView -
we have requirment accessibility when given activity opens , user has talkback accessibility on, client wants talk not read activity name, text of our welcometext
textview. text view dynamic in "welcome, "
i tried doing in activity oncreate() saying:
welcometext =(textview)getview().findviewbyid(r.id.authenticatednowishlistwelcometext); welcometext.setfocusableintouchmode(true); welcometext.requestfocus();
but not working.. can tell me how can talk read given textview upon launch without user interaction?
the important thing realize here, focus
, accessibility focus
not same thing.
you looking following:
welcometext.sendaccessibilityevent(accessibilityevent.type_view_focused);
be careful when this. doing in oncreate bad idea, happen when application activity loaded. want happen each time resumed. also, @ (talkback) creates connection activity @ point in lifecycle, , want sure don't have race condition. talkback must connect activity before post accessibility event.
though note, may bad requirement. wcag 3.2.1 , 3.2.3 state navigation should consistent , predictable, , part of avoiding unexpected shifts of focus. considered violation of these guidelines, , less accessible not doing so.
Comments
Post a Comment