Search code examples
javablackberryuser-input

How do I use the TrackBall API in Blackberry?


I want to scroll up and down in a custom menu I have made using the trackball, but how do I receive and filter the trackball events? (I know how to process keyboard events using protected boolean keyChar(char key, int status, int time).)


Solution

  • Your best bet is to use the navigationClick, navigationMovement and navigationUnclick methods in Field:

    http://www.blackberry.com/developers/docs/4.2.1api/net/rim/device/api/ui/Screen.html#navigationMovement%28int,%20int,%20int,%20int%29

    Or if you want to get the events before any of the fields do, override the same methods on the top-level Screen.

    RIM strongly discourages the use of the old trackwheel API. Navigation is the way to go.