Determine the type of input method

  1. Import one or more of the following classes:
    • net.rim.device.api.ui.Screen
    • net.rim.device.api.ui.Field
  2. Import the net.rim.device.api.system.KeypadListener interface.
  3. Implement the net.rim.device.api.system.KeypadListener interface.
  4. Extend the Screen class, the Field class, or both.
  5. In your implementation of one of the navigationClick, navigationUnclick, or navigationMovement methods, perform a bitwise AND operation on the status parameter to yield more information about the event. Implement the navigationClick(int status, int time) method to determine if the trackwheel or a four way navigation input device (for example, a trackball) triggers an event.
    public boolean navigationClick(int status, int time) {
       if ((status & KeypadListener.STATUS_TRACKWHEEL) == KeypadListener.STATUS_TRACKWHEEL) {
          //Input came from the trackwheel
       } else if ((status & KeypadListener.STATUS_FOUR_WAY) == KeypadListener.STATUS_FOUR_WAY) {
          //Input came from a four way navigation input device 
       }
       return super.navigationClick(status, time);
    }
    For more information about status modifiers for the net.rim.device.api.system.KeypadListener class, see the API reference for the BlackBerry® Java® Development Environment.

Was this information helpful? Send us your comments.