TalkBack

TalkBack is an Android screen reader made by Google. It speaks out the contents of a screen based on what the user is doing.

TalkBack works because it is an accessibility service, which is a special component that can read information from the screen (no matter which app you are using). Anyone can write their own accessibility service, but TalkBack is the most popular.

To use TalkBack, install the Android Accessibility Suite through the Play Store app on your emulator or device (Figure 18.1). If you choose to use an emulator, you must use an emulator image that has the Play Store installed.

Figure 18.1  Android Accessibility Suite

Android Accessibility Suite

Next, make sure the device’s sound output is not muted – but you may want to grab headphones, because once TalkBack is enabled the device will do a lot of “talking.”

To enable TalkBack, launch Settings and press Accessibility. Press on TalkBack under the Screen readers heading. Then press the Use service switch near the top right of the screen to turn TalkBack on (Figure 18.2).

Figure 18.2  TalkBack settings screen

TalkBack settings screen

Android presents a dialog asking for permission to access certain information, such as observing the user’s actions, and to alter certain settings, such as turning on Explore by Touch (Figure 18.3). Press OK.

Figure 18.3  Giving TalkBack permission

Giving TalkBack permission

If this is your first time using TalkBack on the device, you will be brought through a tutorial. When you return to the TalkBack settings menu, exit it by pressing the Up button in the toolbar (the left-pointing arrow).

You will notice something different right away. A green outline appears around the Up button (Figure 18.4) and the device speaks: “Navigate Up button. Double-tap to activate.”

Figure 18.4  TalkBack enabled

TalkBack enabled

(Although “press” is the usual terminology for Android devices, TalkBack uses “tap.” Also, TalkBack uses double-taps, which are not commonly used in Android.)

The green outline indicates which UI element has accessibility focus. Only one UI element can have accessibility focus at a time. When a UI element receives focus, TalkBack will provide information about that element.

When TalkBack is enabled, a single press (or “tap”) gives an element accessibility focus. Double-tapping anywhere on the screen activates the element that has focus. So double-tapping anywhere when the Up button has focus navigates up, double-tapping when a checkbox has focus toggles its check state, and so on. (Also, if your device locks, you can unlock it by pressing the lock icon and then double-tapping anywhere on the screen.)

Explore by Touch

By turning TalkBack on, you have also enabled TalkBack’s Explore by Touch mode. This means the device will speak information about an item immediately after it is pressed. (This assumes that the item pressed specifies information TalkBack can read, which you will learn more about shortly.)

Leave the Up button selected with accessibility focus. Double-tap anywhere on the screen. The device returns you to the Accessibility menu, and TalkBack announces information about what is showing and what has accessibility focus: “Accessibility. Navigate Up button. Double-tap to activate.”

Android framework widgets, such as Toolbar, RecyclerView, and Button, have basic TalkBack support built in. You should use framework widgets as much as possible so you can leverage the accessibility work that has already been done for those widgets. It is possible to properly respond to accessibility events for custom widgets, but that is beyond the scope of this book.

To scroll the list on a physical device, hold two fingers on the screen and drag them up or down. To scroll the list on an emulator, hold down the Command (Ctrl) button on the keyboard, click on one of the two larger, semitransparent circles that appear, and drag up or down with your mouse or trackpad (Figure 18.5).

Figure 18.5  Scrolling on the emulator

Scrolling on the emulator

Depending on the length of the list, you will hear tones that change as you scroll. These tones are earcons, sounds used to give meta information about the interaction.

Linear navigation by swiping

Imagine what it must be like to explore an app by touch for the first time. You would not know where things are located. What if the only way to learn what was on the screen was to press all around until you landed on an element that TalkBack could read? You might end up pressing on the same thing multiple times – worse, you might miss elements altogether.

Luckily, there is a way to explore the UI linearly, and in fact this is the more common way to use TalkBack: Swiping right moves accessibility focus to the next item on the screen. Swiping left moves accessibility focus to the previous item on the screen. This allows the user to walk through each item on the screen in a linear fashion, rather than trial-and-error poking around in hopes of landing on something meaningful.

Try it out for yourself. Launch CriminalIntent and go to the crime list screen. By default, accessibility focus will be given to the + action item in the app bar. (If not, press on the + to give it accessibility focus.) The device reads out, “CriminalIntent. New Crime. Double-tap to activate.” (Figure 18.6).

Figure 18.6  New Crime action item selected

New Crime action item selected

For framework widgets, such as menu items and buttons, TalkBack will read the visible text content displayed on the widget by default. But the New Crime menu item is just an icon and does not have any visible text. In this case, TalkBack looks for other information in the widget. You specified a title in your menu XML, and that is what TalkBack reads to the user. TalkBack will also provide details about actions the user can take on the widget and sometimes information about what kind of widget it is.

Now swipe left. Accessibility focus moves to the CriminalIntent title in the app bar. TalkBack announces, “CriminalIntent” (Figure 18.7).

Figure 18.7  App bar title selected

App bar title selected

Swipe right, and TalkBack reads information about the + (New Crime) menu button again. Swipe right a second time; accessibility focus moves to the first crime in the list. Swipe left, and focus moves back to the + menu button. Android does its best to move accessibility focus in an order that makes sense.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
52.14.253.170