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 clicking 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 TouchEvent.getEvent()
returns is equal to TouchEvent.CLICK.
protected boolean touchEvent(TouchEvent message) { switch(message.getEvent()) { case TouchEvent.CLICK: Dialog.alert("CLICK occurred"); return true; } return false; }