Development Guide
Local Navigation
- UI
- Fundamental UI components
- Drawing directly on a screen
- UI life cycle
- UI components
- Events
- Command Framework API
- Arranging UI components
- Advanced UI components and managers
- Menu items
- Fonts
- Spelling checker
- Barcode scanning
- BlackBerry device user input and navigation
- Navigation 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
- Accelerometer
- Magnetometer
- Tutorial: Creating a custom button
- 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 - 7.0
Respond to a user touching the screen in two locations at the same time
- 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, check if the following method invocations return values greater than zero:
TouchEvent.getX(1), TouchEvent.getY(1), TouchEvent.getX(2), TouchEvent.getY(2).
protected boolean touchEvent(TouchEvent message) { switch(message.getEvent()) { case TouchEvent.MOVE: if(message.getX(1) > 0 && message.getY(1) > 0) { Dialog.alert("First finger touched/moved"); } if(message.getX(2) > 0 && message.getY(2) > 0) { Dialog.alert("Second finger touched/moved"); } return true; } return false; }
Next topic: Pinch gestures
Previous topic: Respond to a scroll action