Help Center

Local Navigation

Provide an assistive technology application with information about a UI change

  1. Import the net.rim.device.api.ui.accessibility.AccessibleContext interface.
  2. Implement the AccessibleContext interface to represent the information about changes to a custom UI component that an application can make available.
  3. Create variables to store accessibility information for a custom UI component, such as state information.
    private int _accessibleStates = AccessibleState.UNSET;
    private String _accessibleName;
    private String _title;
    
  4. Create methods that add and remove the states for a custom UI component.
    protected void addAccessibleStates(int states) {
      _accessibleStates = _accessibleStates & ~AccessibleState.UNSET;
      _accessibleStates = _accessibleStates | states;
     }
     protected void removeAccessibleStates(int states) {
      _accessibleStates = _accessibleStates & ~states;
     }
     public void setAccessibleName(String accessibleName) {
      _accessibleName = accessibleName;
     }
    
  5. Implement the get() methods of the AccessibleContext interface, to allow access to tabular, textual, or numerical information for a custom UI component.
    public AccessibleTable getAccessibleTable() {
    		return null;
    }
    public AccessibleText getAccessibleText() {
    	return null;
    }
    public AccessibleValue getAccessibleValue() {
     return null;
    }
    
  6. Create a method that returns an instance of the class that implements the AccessibleContext interface, to provide information about a change to a custom UI component.
    public AccessibleContext getAccessibleContext() {
    	return this;
    }
    
  7. Implement AccessibleContext getAccessibleChildAt(int), to provide information about a custom UI component that this UI component contains.
    public AccessibleContext getAccessibleChildAt(int arg0) {
     return (Icon) icons.elementAt( index );
    }
    
  8. Implement getAccessibleChildCount(), to provide information about the number of accessible components that a custom UI component contains. The number of accessible components includes accessible children of the component. For example, a DateField does not contain any UI components but does contain three accessible children: date, month, and year.
    public int getAccessibleChildCount() {
    	return 0;
    }
    
  9. Implement AccessibleContext getAccessibleName(), to provide the name of a custom UI component that changes.
    public String getAccessibleName() {
    	return _accessibleName;
    }
    
  10. Create a method that invokes AccessibleEventDispatcher.dispatchAccessibleEvent(stateChange, oldState, newState, this), to send a notification when the state of a custom UI component changes. Use the following information as arguments to the method:
    • the event
    • the old state of the custom UI component
    • the new state of the custom UI component
    • an instance of the custom UI component
    public void accessibleEventOccurred(int stateChange, Object oldState, Object newState) {
    AccessibleEventDispatcher.dispatchAccessibleEvent(stateChange, oldState, newState, this);
    }
    

Index


Was this information helpful? Send us your comments.