Featured classes

net.rim.device.api.system.EventInjector

This class provides the method invokeEvent() for injecting UI events into a BlackBerry® device application.

This class contains the subclasses Event, KeyCodeEvent, KeyEvent, NavigationEvent, TouchEvent and TrackWheelEvent. These subclasses represent different UI events on a BlackBerry device.

The sample application uses the invokeEvent() method to inject the TouchEvent objects that the sample application creates.

net.rim.device.api.system.EventInjector.TouchEvent

This class represents a UI event on a BlackBerry device with a touch screen.

In addition to allowing you to create discrete touch events such as clicking and unclicking the touch screen, this class also provides you with the following methods, which inject a series of touch events when they are invoked:

Method

Description

Sequence of generated events

injectSwipeGesture(int originX, intOriginY, EventInjector.TouchEvent[] moveEvents)

This method simulates the series of events that occur when a user slides a finger on the touch screen starting at the position (originX, originY) and moves along the screen as defined by the moveEvents array.

  1. DOWN at (originX, originY)
  2. MOVE at the position that the first move event in moveEvents array specifies if moveEvents is not null; event occurs for each TouchEvent entry in the moveEvents array
  3. SWIPE event
  4. UP at (originX, originY)

injectTapGesture(int x, int y, int taps)

This method simulates the series of events that occur when a user touches the screen lightly a number of times (specified by the taps parameter) at the position (x, y).

  1. DOWN at (x1, y1)
  2. TAP at (x1, y1); event repeats the number of times that the taps parameter specifies
  3. UP at (x1, y1)
injectTwoFingerTap(int x1, int y1, int x2, int y2, int touchpoint)

This method simulates the series of events that occur when a user simultaneously touches the screen with two fingers. The first finger touches the screen at the position (x1, y1) and the second finger touches the screen at the position (x2, y2).

The touchpoint parameter specifies which finger's position specifies the position of the TAP gesture.

If touchpoint equals 1, the following events occur:

  1. DOWN at (x1, y1)
  2. DOWN at (x2, y2)
  3. TAP at (x1, y1)
  4. UP at (x1, y1)
  5. UP at (x2, y2)

If touchpoint equals 2, the following events occur:

  1. DOWN at (x1, y1)
  2. DOWN at (x2, y2)
  3. TAP at (x2, y2)
  4. UP at (x2, y2)
  5. UP at (x1, y1)
invokeClickThrough(int x1, int y1, int x2, int y2)

This method simulates the series of events that occur when a user clicks the touch screen at the position (x1, y1).

If you specify the position (x1, y1) as (-1, -1), the click occurs at the position (x2, y2).

If (x1, y1) does not equal (-1, -1), the following events occur:

  1. DOWN at (x1, y1)
  2. CLICK at (x1, y1)
  3. UNCLICK at (x1, y1)
  4. UP at (x1, y1)

If (x1, y1) equals (-1, -1), the following events occur:

  1. DOWN at (x2, y2)
  2. CLICK at (x2, y2)
  3. UNCLICK at (x2, y2)
  4. UP at (x2, y2)
Previous topic: Overview

Was this information helpful? Send us your comments.