Help Center
Local Navigation
- Creating a UI that is consistent with standard BlackBerry UIs
- BlackBerry device user input and navigation
- Screens
- Accelerometer
-
Events
- Respond to navigation events
- Determine the type of input method
- Touch screen interaction models
-
Responding to touch screen events
- Respond to system events while the user touches the screen
- Respond to a user sliding a finger up quickly on the screen
- Respond to a user sliding a finger down quickly on the screen
- Respond to a user sliding a finger to the left quickly on the screen
- Respond to a user sliding a finger to the right quickly on the screen
- Respond to a user clicking the screen
- Respond to a user touching the screen twice quickly
- Respond to a user touching and dragging an item on the screen
- Respond to a user touching the screen lightly
- Respond to a scroll action
- Respond to a user touching the screen in two locations at the same time
- Pinch gestures
- Swipe gestures with trackpads
- Event injection
- Command Framework API
- Arranging UI components
- UI components
- Images
- Menu items
- Custom fonts
- Spelling checker
- Related resources
- Glossary
- Provide feedback
- Document revision history
- Legal notice
BlackBerry Manuals & Help
>
Developer Documentation
>
Java Development Guides and API Reference
>
Development Guide
UI and Navigation - BlackBerry Java SDK - 6.0
Respond to a user sliding a finger up quickly on the screen
- Import the following classes:
- Create a class that extends the Manager class, the Screen class, the Field
class, or one of the Field
subclasses.
public class newButtonField extends ButtonField { - In your implementation of the touchEvent(TouchEvent message) method, invoke TouchEvent.getEvent().
- Check if the value that TouchGesture.getSwipeDirection()
returns is equal to TouchGesture.SWIPE_NORTH.
protected boolean touchEvent(TouchEvent message) { switch(message.getEvent()) { case TouchEvent.GESTURE: TouchGesture gesture = message.getGesture(); switch(gesture.getEvent()) { case TouchGesture.SWIPE: if(gesture.getSwipeDirection() == TouchGesture.SWIPE_NORTH) { Dialog.alert("Upward swipe occurred"); return true; } } return false; } }
Previous topic: Respond to system events while the user touches the screen