Sorry about the red box, but we really need you to update your browser. Read this excellent article if you're wondering why we are no longer supporting this browser version. Go to Browse Happy for browser suggestions and how to update.

The AccessibilityDemo sample app

BlackBerry Java Development Environment 4.6.1 and later and BlackBerry Java Plug-in for Eclipse with BlackBerry Component Package 4.6.1 and later provide a sample app that demonstrates the communication between an accessible application and an assistive technology application.

The AccessibilityDemo application consists of two projects.

Project

Description

CustomComponentsDemo

CustomComponentsDemo is the accessible application. The screen contains custom UI components that implement the AccessibleContext interface, and, if appropriate, the AccessibleText interface, the AccessibleTable interface, or the AccessibleValue interface.

The AccessibleContext interface provides information about the accessible object, such as its value and state, to the assistive technology application.

The UI components broadcast accessibility events, such as when focus is set on a component or when a component's value changes.

ScreenReaderDemo

ScreenReaderDemo is the assistive technology application, a screen reader. The ScreenReader class is registered as an accessibility event listener and implements the AccessibleEventListener interface. ScreenReader receives the accessibility events that CustomComponentsDemo broadcasts.

For demonstration purposes, the screen reader outputs System.out.println() statements to handle the accessibility events.

Set up the AccessibilityDemo sample application in the BlackBerry Java Plug-in for Eclipse

Verify that you are using BlackBerry Java Plug-in for Eclipse 1.1 or later with BlackBerry JDE Component Package 4.6.1 or later.

In Eclipse, open a workspace.

On the File menu, click Import.

In the Import dialog box, expand the BlackBerry folder and select the Import BlackBerry Samples option.

Click Next.

In the Import BlackBerry Samples dialog box, click Deselect All.

Select the check box beside the CustomComponentsDemo project.

The check box beside the ScreenReaderDemo project is automatically selected.

Click Finish.

The CustomComponentsDemo and ScreenReaderDemo projects display in the Package Explorer. The BlackBerry Java Plug-in for Eclipse sets the Java build path for CustomComponentsDemo to include ScreenReaderDemo, which CustomComponentsDemo references.

The sample app can also be downloaded from http://www.blackberry.com/go/accessibilitysample.

Explore the AccessibilityDemo sample app

In the BlackBerry Java Plug-in for Eclipse, on the Window menu, select Show View > Console.

In the BlackBerry Java Plug-in for Eclipse, right-click the CustomComponentsDemo project in the Project Explorer, then on the Debug As menu, select BlackBerry Simulator.

Perform one of the following actions to start a debugging session:

In the BlackBerry Smartphone Simulator, run the AccessibilityDemo application in the Downloads folder.

The simulator displays the Home screen for the application, which is made up of a row of icons, a table, a custom numeric field, and a custom text field.

In the simulator, select the numeric field under the table. Press the U key on the simulator's keyboard twice to increase the value for the field.

The console window displays the standard output from the assistive technology application (a screen reader). A screen reader listens for events on the UI components and processes the events. The screen reader in the AccessibilityDemo sample application responds to events with System.out.println() statements, which the console window displays.

The println() statements show the communication between the sample accessible application and the sample screen reader. An actual screen reader responds to the events in an accessible application in a useful way, such as by speaking the text.

ScreenReader Context: 
com.rim.samples.device.accessibilitydemo.customcomponentsdemo.ValueComponent@fcbe0dd8
---------------- SOUND:  My Gauge Field  value changed to 51
ScreenReader Context: com.rim.samples.device.accessibilitydemo.customcomponentsdemo.ValueComponent@fcbe0dd8
---------------- SOUND:  My Gauge Field  value changed to 52