jeudi 18 janvier 2018

Android Accesibility: sending several accessibility events on a single touch

Inside one of my recycle view adapters, I have a layout which displays an image and a checkbox.

I am adding accessibility for the app, and I want it so that when a user touches a picture, it will get a reading of the image and the current state of the checkbox (as in, "checked" or "unchecked", which is what the accessibility assistant reads, not true or false)

The two separate lines of code which I have used fit my purpose are as follows:

myImageView.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_SELECTED);
myCheckbox.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_SELECTED);

But if I run that call on the click event, the first instruction is cut short and only the second one is heard. So I believe this might not be the way to go. I probably have to use all of the Accessibility classes provided by Android, but I have no clue where to start.

What should I do for the voice feedback to read "Image one, checked... Image two, unchecked".

Additional info: I cannot use strings to get the wanted value from the checkbox boolean, because the app is multilingual and instead of having to get all the string resources I would rather take advantage of the system.

Thank you everyone for your time.




Aucun commentaire:

Enregistrer un commentaire