Help Center

Local Navigation

Enable an assistive technology application to receive notification of UI events

If you are building an assistive technology application, such as a screen reader, implement the AccessibleEventListener interface.

  1. Import the required interface.
    import net.rim.device.api.ui.accessibility.AccessibleEventListener;
  2. Create a class that implements the AccessibleEventListener interface.
    public class ScreenReader implements AccessibleEventListener 
    {
    }
  3. Implement AccessibleEventListener.accessibleEventOccurred(int event, Object oldValue, Object newValue, AccessibleContext context), to respond to UI events in an accessible application that registers this assistive technology application as an AccessibleEventListener.
    public synchronized void accessibleEventOccurred(
      int event, 
      Object oldValue, 
      Object newValue, 
      AccessibleContext context)
    {
      if(context == null)
      {
        return;
      }
            
      int oldState = (oldValue instanceof Integer) ? ((Integer) oldValue).intValue() 
        : 0;
      int newState = (newValue instanceof Integer) ? ((Integer) newValue).intValue() 
        : 0;  
            
      switch(context.getAccessibleRole()) 
      {
        case AccessibleRole.APP_ICON: 
          ScreenReaderHandler.handleAppIcon(event, oldState, newState, context);
          break;
                    
        case AccessibleRole.ICON: 
          ScreenReaderHandler.handleIcon(event, oldState, newState, context);
          break;
                    
        case AccessibleRole.CHECKBOX: 
          ScreenReaderHandler.handleCheckBox(event, oldState, newState, context);
          break;
                    
        case AccessibleRole.CHOICE: 
          ScreenReaderHandler.handleChoice(event, oldState, newState, context);
          break;
                
        ...
    
      }
    } 
    

Index


Was this information helpful? Send us your comments.