One often overlooked aspect of mobile application design is accessibility. That is, designing the application such that it functions well for all users, including those with special needs or disabilities. Increasingly, accessibility features are needed for specific user situations as well; for example, automobile drivers are now limited in their device usage by traffic safety laws.
As mobile platforms have matured, accessibility features have begun to appear as part of the developer SDKs, but they are easily overlooked or forgotten about by novice developers who simply rapid prototype their application and throw it up onto the Android Market. These developers are missing an exciting opportunity to differentiate their applications from others by integrating simple but robust accessibility features at design time. Doing so helps both the users (who may need these features to use the app) and the developer (who wants as many users downloading and using the app as possible).
The Android SDK includes many features to support accessibility. In addition to the primary accessibility packages, there are subtle accessibility features peppered throughout the commonly used classes of the SDK. Let’s look at some of the top features of the Android SDK designing and building highly accessible applications. These methods are discussed in order of difficulty from easy to more challenging.
#1: Use View Content Descriptions
One of the easiest ways to improve the accessibility of your application is to provide content descriptions to each of the View controls in your user interfaces. This information can be used by accessibility services and tools like screen readers to help visually-impaired users navigate your application user interfaces. In XML, the attribute is called android:contentDescription. The related View class method is setContentDescription. For example, if you had an ImageView control with a picture of a gorilla, you might set a content description string saying as much. Similarly, you can use content descriptions to differentiate between Button controls when more than one is displayed on the screen by providing a short description naming that Button control’s purpose.
#2: Leverage Haptic Feedback Features
As the Android SDK documentation so eloquently puts it: “BZZZTT!!1!” Haptic feedback is that little physical vibration you feel when you press controls on the touchscreen of the device. View controls have certain built-in haptic feedback features. However, you can override the default behavior easily to provide your own haptic feedback features for other events. Haptic features for a given control can be enabled or disabled, and events can be generated by the developer. See the View control attributes and methods associated with haptic feedback for details .
#3: Leverage Text-to-Speech Services
Text-to-speech (TTS) services take textual data and have the device “read” the content aloud using a computer “voice.” Hands-free applications, such as navigation apps routinely use this technology to provide turn-by-turn directions to automobile drivers, while the visually impaired can also use this type of service to help decipher text on the screen. The TTS features available with the Android SDK are found in the android.speech.tts package and are very easy to incorporate into your applications with the TextToSpeech class (android.speech.tss.TextToSpeech).
#4: Leverage Speech Recognition Services
Simply text-to-speech in reverse, speech recognition services take voice input from the user and turn it into textual data. You’ll frequently see this service used by search applications and contact management applications that respond to specific commands like “Call Mom.” The speech recognition features available with the Android SDK are found in the android.speech package and are very easy to incorporate into your applications with the android.speech.RecognizerIntent intent. This intent can be used to launch the built-in speech recorder and retrieve the resulting text to your application.
We discuss TTS and speech recognition services in detail, with fully functional code, in our Developer.com article entitled “Add Text-To-Speech and Speech Recognition to Your Android Applications.”
#5: Support Alternative Input Methods
Some Android devices have directional controllers like directional-pads, trackballs, and arrow keys. These types of devices are often favored by those with visual impairments, as they allow the user to systematically navigate a screen of components. Ensure your applications provide support for these input methods as well as simple touchscreens. Special attention must be given to the order in which View controls within a layout gain focus. You can override the focus order of View controls within a layout using the android:nextFocus* attributes.
#6: Implementing Custom Views? Make Sure They Send Appropriate Accessibility Events
There are a number of system services operating on the Android platform to keep it running smoothly. One such service is the accessibility service. When a built-in View control like a Button control is clicked, it tells the accessibility service “I’ve been clicked!” When you implement custom View controls, it is your responsibility to send appropriate events to the accessibility service. To do this, your custom View control must implement the AccessibilityEventSource interface (android.view.Accessibility.AccessibilityEventSource) and fire off AccessibilityEvent events (android.view.Accessibility.AccessibilityEvent).
#7: Using Your Own Accessibility Technology?
If you have your own accessibility technology, you’ll want to hook into accessibility events. This can be done by implementing your own AccessibilityService (android.accessibilityservice.AccessibilityService), an Android Service class that receives calls when AccessibilityEvent actions are triggered. This service receives calls for a variety of different events useful in providing some sort of accessibility augmentation. Some of these events include the user clicking on a View object, changing focus on an control, or the text on an object changing–the same sorts of events you must make sure to implement when making your own controls.
The accessibility features of the Android SDK are robust, lightweight and easy to use; there’s little reason not to use them. Not considering accessibility at application design time limits your potential user base and alienates certain groups of users needlessly. The depth to which your specific application supports accessibility features depends on the intended audience and specific project goals. However, all applications can greatly improve their accessibility with just a few simple updates.
About the Authors
|Shane Conder and Lauren Darcey —Contributing Editors, Mobile Development –have coauthored two books on Android development: an in-depth programming book entitled Android Wireless Application Development (ISBN-13: 978-0-321-62709-4) and Sams Teach Yourself Android Application Development in 24 Hours (ISBN-13: 978-0-321-67335-0). When not writing, they spend their time developing mobile software at their company and providing consulting services.