Swipe gestures with trackpads

Similar to BlackBerry® devices with a touch screen, devices with a trackpad support swipe gestures that BlackBerry device users make on the trackpad.

A TouchEvent object with the event type TouchGesture.NAVIGATION_SWIPE is generated when the user swipes across the trackpad. You can retrieve information about the trackpad swipe by using the following methods:

Code sample: Retrieving information about a trackpad swipe

This sample demonstrates how to handle a trackpad swipe in a screen's touchEvent() method.

protected boolean touchEvent(TouchEvent message) 
      case TouchEvent.GESTURE:
         TouchGesture gesture = message.getGesture();
           case TouchGesture.NAVIGATION_SWIPE:
             Dialog.alert("Swipe direction: " + gesture.getSwipeDirection()  
             +            ", "
             +            "\nMagnitude: " + gesture.getSwipeMagnitude());
             return true;
   return false;
Previous topic: Enable pinch gestures

Was this information helpful? Send us your comments.