Test an accessible BlackBerry device application

You can create a test screen reader and use it to test and debug your accessible application in BlackBerry® Java® Development Environment 4.6.1 or later or BlackBerry® Java® Plug-in for Eclipse® with BlackBerry Component Package 4.6.1 or later.

Note: Before you make your accessible application available to BlackBerry device users, you should test it on a production screen reader or other assistive technology application that is installed on a BlackBerry device, to verify that your application works the way you want it to.
  1. Import the required interface.
    import net.rim.device.api.ui.accessibility.AccessibleEventListener;
  2. Create a screen reader class that implements the AccessibleEventListener interface.
    public class ScreenReader implements AccessibleEventListener 
  3. Implement accessibleEventOccurred() to handle the accessible events.
    public synchronized void accessibleEventOccurred(
      int event, 
      Object oldValue, 
      Object newValue, 
      AccessibleContext context)
        case AccessibleRole.APP_ICON: 
          ScreenReaderHandler.handleAppIcon(event, oldState, newState, context);
        case AccessibleRole.ICON: 
          ScreenReaderHandler.handleIcon(event, oldState, newState, context);
  4. In the event-handling methods, include println() statements to specify the information that you want to generate about the accessible events.
    static void handleIcon(int event, int oldValue, int newValue, AccessibleContext context)
      if(event == AccessibleContext.ACCESSIBLE_STATE_CHANGED) 
        if(Util.hasTransitionedToState( oldValue, newValue, AccessibleState.FOCUSED)) 
          String appName = context.getAccessibleName();                
          System.out.println("---------------- SOUND: " + appName + " icon focused");
  5. In your accessible application, register the screen reader class as an accessible event listener.
    _screenReader = new ScreenReader();
  6. Build the accessible application and the screen reader.
  7. Perform one of the following actions to display the console window:
    • In the BlackBerry Java Plug-in for Eclipse, on the Window menu, select Show View > Console.
    • In the BlackBerry JDE, on the View menu, click Output, and click the Debug tab.
  8. Perform one of the following actions to start a debugging session:
    • 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.
    • In the BlackBerry JDE, on the Debug menu, click Go.
  9. In the BlackBerry Smartphone Simulator window, test your accessible application.
The console window displays the standard output that comes from the screen reader, which is listening for events on the UI components and processing the events.
---------------- SOUND:  Media  icon focused
Next topic: Related resources

Was this information helpful? Send us your comments.