Using labels to provide context
The android:labelFor attribute tells TalkBack that the TextView serves as a label to the view
specified by the ID value. labelFor is defined on the View class, so you can associate any view as
the label for any other view. Note that you must use the @+id syntax here because you are referring
to an ID that has not been defined at that point in the file. You could now remove the + from the
android:id="@+id/crime_title" line in the EditText’s definition, but it is not necessary to do so.
Run your app and press on the title EditText. TalkBack now announces, “Edit box. Sticker vandalism,
for title.”
Congratulations on making your app more accessible. One of the most common reasons developers
cite for not making their apps more accessible is lack of awareness about the topic. You are now
aware and can see how easy it is to make your apps more usable to TalkBack users. And, as a bonus,
improving your app’s TalkBack support means it will also be more likely to support other accessibility
services, such as BrailleBack.
Designing and implementing an accessible app may seem overwhelming. People make entire careers
out of being accessibility engineers. But rather than forgoing accessibility altogether because you fear
you will not do it right, start with the basics: Make sure every meaningful piece of content is reachable
and readable by TalkBack. Make sure TalkBack users get enough context to understand what is going
on in your app – without having to listen to extraneous information that wastes their time. And, most
importantly, listen to your users and learn from them.
With that, you have reached the end of your time with CriminalIntent. In 13 chapters, you have created
a complex application that uses fragments, talks to other apps, takes pictures, stores data, and even
speaks Spanish. Why not celebrate with a piece of cake?
Just be sure to clean up after yourself. You never know who might be watching.