This codelab is part of the Advanced Android Development training course, developed by the Google Developers Training team. You will get the most value out of this course if you work through the codelabs in sequence.

For complete details about the course, see the Advanced Android Development overview.

Introduction

Android apps should be usable by everyone, including people with disabilities.

Common disabilities that can affect a person's use of an Android device include blindness, low vision, color blindness, deafness or hearing loss, and restricted motor skills. When you develop your apps with accessibility in mind, you make the user experience better not only for users with these disabilities, but also for all of your other users.

In this lesson, you explore the features Android provides on the device to enable accessibility, including Google TalkBack (Android's screen reader) and other options in the Android framework.

What you should already know

You should be familiar with:

What you'll learn

What you will do

App overview

For this lesson you use the built-in Android settings and apps. You do not build an app.

TalkBack is Android's built-in screen reader. With TalkBack enabled, the user can interact with their Android device without seeing the screen, because Android describes screen elements aloud. Users with visual impairments might rely on TalkBack to use your app.

In this task, you enable TalkBack to understand how screen readers work and how to navigate apps.

1.1 Turn on TalkBack

  1. On an Android device or emulator, navigate to Settings > Accessibility > TalkBack.
  2. Tap the On/Off toggle button to turn on TalkBack.
  3. Tap OK to confirm permissions.
  4. Confirm your device password, if asked.

If this is the first time you've run TalkBack, a tutorial launches. (The tutorial may not be available on older devices.) Use the tutorial to learn about:

It may be helpful to navigate the tutorial with your eyes closed. To open the tutorial again in the future, navigate to Settings > Accessibility > TalkBack > Settings > Launch TalkBack tutorial.

1.2 Explore apps with TalkBack

With TalkBack enabled, explore the Camera and Calculator apps with these steps:

  1. Tap the Home button, then double-tap the button to activate it and return to the Home screen.
  2. Tap the Camera icon, then double-tap to activate it.
  3. Explore the various buttons and options in the Camera app. TalkBack identifies each button and control by its function (for example, "Shutter Button" or "Zoom Out" button), not by its appearance ("plus button").
  4. Tap the Home button, then double-tap the button to activate it and return to the Home screen.
  5. Navigate to the Apps screen and activate the Calculator app.
  6. Swipe right with one finger to navigate the views on the screen. Navigation in the app is not strictly left-to-right and top-to-bottom. All the numbers in the leftmost panel are identified before all the operations in the middle panel.
  7. Keep swiping right to navigate to the advanced options screen, which is a panel in green that moves out from the right. Swipe left and double-tap to activate the main view and close the advanced operations. Note how these panel views do not have visible labels, but are identified by purpose in TalkBack.
  8. Perform the calculation 3 times 5. TalkBack reads the numbers, the operation as the numbers are multiplied, and the result.
  9. Navigate back to Settings > Accessibility > TalkBack, and turn off TalkBack.

1.3 Other speech settings

TalkBack is the most comprehensive of Android's screen reader functions. Besides TalkBack, Android provides other features for on-demand screen reading.

  1. Navigate to Settings > Accessibility > Select to Speak.
    If you don't see Select to Speak, go to Google Play to download the latest version of TalkBack.
  2. Tap the On/Off toggle button.
  3. Tap OK to confirm permissions.
  4. Confirm your device password, if asked.

A speech button appears in the lower right corner of the screen. Select to Speak works similarly to TalkBack, but Select to Speak works only on user-selected parts of the screen, and only by request.

  1. Tap the speech button, then tap to select a portion of the text on the screen. Android reads that text to you.
  2. Tap the Back button to return to the main Accessibility settings page.
  3. Tap the speech button, then select a portion of the screen. Android reads all the text in the selection.
  4. Tap Select to Speak. Turn the toggle button off.
  5. Tap the Back button, then scroll down and tap Accessibility shortcut.

This option lets you use the device buttons to enable TalkBack by holding down the power button and then touching and holding two fingers on the screen. To disable TalkBack again, you must go to Settings > Accessibility and turn it off manually.

  1. Tap the Back button, then scroll down to Text-to-Speech output. Tap that item.

The Google text-to-speech engine is used for TalkBack and other text-to-speech functions in apps that support speech-to-text. On this screen you can configure the settings for speech rate and pitch. You can also configure the speech language, change the language, and install new language packs. (To see all the options, tap the gear icon on the Text-to-Speech output screen.)

TalkBack, Select to Speak, and the text-to-speech engine are helpful for users with visual impairments. Android provides several other accessibility features. In this task, you explore some of these other options.

2.1 Explore magnification, font, and display

  1. On an Android device or emulator, navigate to Settings > Accessibility > Magnification gesture.
  2. Tap the On/Off toggle button.

To use the magnification gesture, tap three times on the screen. Android zooms into the spot where you tapped, providing a magnified view. Tap again three times to exit magnification mode.

  1. Tap the Back button to return to the accessibility settings.
  2. Tap Font size. Move the slider all the way to the right to increase the font size to the largest setting. The preview at the top of the screen shows text at the chosen size.

A larger font size can make apps easier to read. A larger font size may cause app elements to also be larger or to wrap in unexpected ways.

  1. Return to the Home screen and examine the effect of the larger font in several apps. Try messages, email, calendar, or any of the apps you've created in this course. Note that apps that use their own internal fonts, such as some games, may not enlarge with this setting.
  2. Navigate back to Settings > Accessibility > Font size and return the font size to the default.
  3. Tap the Back button, select Display size, and move the slider all the way to the right.

Enlarging the display size makes all elements on the screen larger, including the text. Fewer elements fit on the screen. Enlarging the display size can make apps easier to read, and it also makes buttons and other interactive elements easier to tap.

  1. Return the slider in the Display size settings to the default position.

2.2 Explore color and contrast

  1. Tap Settings > Accessibility > High contrast text.

High contrast text fixes the display text to be either black or white, depending on the background, and outlines the text to emphasize it. High contrast text can make text easier to read.

  1. Return to the Home screen. See how text appears in messages, email, calendar, or any of the apps you've created in this course.
  2. Return to Settings > Accessibility and turn High contrast text off again.
  3. Scroll down to Color inversion and tap to turn it on.

Color inversion reverses the colors on your screen. For example, black text on a white screen becomes white text on a black screen. Color inversion can make some text easier to read and reduce eye strain.

  1. Return to the Home screen and try some apps with inverted colors.
  2. Swipe from the top of the screen to open the navigation drawer. Click the down arrow to open the quick settings.
  3. Tap Invert colors to disable color inversion.
  4. Navigate to Settings > Accessibility > Color Correction.

Color correction changes the system colors to help users with various forms of color blindness distinguish screen elements.

  1. Tap the On/Off toggle button.
  2. Navigate to the Home screen and note the differences in system colors.
  3. Return to the Color Correction setting and tap to turn it off.

High contrast text, Color inversion, and Color correction are experimental features in Android. The features may not work in all apps and may affect app performance.

In the next practical, you learn how to support accessibility features in your own apps.

Solution code

No project for this practical.

Challenge: Download and build the RecyclerView app, if you have not already done so. Run the RecyclerView app with TalkBack enabled, and note where you could improve the label text and feedback.

The related concept documentation is in 6.1 Accessibility.

Android support documentation:

Other:

This section lists possible homework assignments for students who are working through this codelab as part of a course led by an instructor. It's up to the instructor to do the following:

Instructors can use these suggestions as little or as much as they want, and should feel free to assign any other homework they feel is appropriate.

If you're working through this codelab on your own, feel free to use these homework assignments to test your knowledge.

Answer these questions

Question 1

Why should you consider making your app accessible?

Question 2

Which of the following are accessibility features available in Android?

Question 3

What is TalkBack?

Question 4

How should you test your app for accessibility?

Submit your findings for grading

No app to submit for this homework assignment.

To see all the codelabs in the Advanced Android Development training course, visit the Advanced Android Development codelabs landing page.