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

java.lang.Object
  extended by net.rim.device.api.system.EventInjector.Event
      extended by net.rim.device.api.system.EventInjector.TouchEvent
Enclosing class:
EventInjector

public static class EventInjector.TouchEvent
extends EventInjector.Event

The event class that defines a touch screen event.

Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 5.0.0

Field Summary
Category: Signed static int CLICK
          Touch screen click input event.
Category: Signed static int DOWN
          Touch screen down input event.
Category: Signed static int MOVE
          Touch screen move input event.
Category: Signed static int UNCLICK
          Touch screen unclick input event.
Category: Signed static int UP
          Touch screen up input event.
 
Constructor Summary
Category: Signed EventInjector.TouchEvent(int event, int x1, int y1, int x2, int y2, int time)
          Creates a TouchEvent with a touch screen event code, coordinates of two touch (finger) points, and time.
 
Method Summary
Category: Signed  int getPoint1X()
          Returns the x coordinate for the first touch point.
Category: Signed  int getPoint1Y()
          Returns the y coordinate for the first touch point.
Category: Signed  int getPoint2X()
          Returns the x coordinate for the second touch point.
Category: Signed  int getPoint2Y()
          Returns the y coordinate for the second touch point.
Category: Signed static void injectSwipeGesture(int originX, int originY, EventInjector.TouchEvent[] moveEvents)
          Injects a swipe gesture.
Category: Signed static void injectTapGesture(int x, int y, int taps)
          Injects a tap or multi tap sequence.
Category: Signed static void injectTwoFingerTap(int x1, int y1, int x2, int y2, int touchPoint)
          Injects a two finger TAP gesture associating the TAP with either the first or second touch point.
Category: Signed static void invokeClickThrough(int x1, int y1, int x2, int y2)
          Creates and invokes the sequence of events (DOWN, CLICK, UNCLICK, UP) which form a click-through.
Category: Signed  void setPoint1(int x1, int y1)
          Sets coordinates for the first touch point.
Category: Signed  void setPoint2(int x2, int y2)
          Sets coordinates for the second touch point.
 
Methods inherited from class net.rim.device.api.system.EventInjector.Event
getEvent, getStatus, getTime, post, setEvent, setStatus, setTimeToCurrent
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 



Field Detail

DOWN

public static final int DOWN
Touch screen down input event. This type of event is generated when the user touches the touchscreen (up to two fingers). Typically used to focus or highlight UI elements on the display.

See Also:
Constant Field Values
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 5.0.0

UP

public static final int UP
Touch screen up input event. This type of event is generated when the user removes touch from the touchscreen (up to two fingers).

See Also:
Constant Field Values
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 5.0.0

MOVE

public static final int MOVE
Touch screen move input event. This type of event is generated in sequence as the user moves finger around the touchscreen screen. Typical drag input sequence: DOWN, MOVE, MOVE..., UP.

See Also:
Constant Field Values
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 5.0.0

CLICK

public static final int CLICK
Touch screen click input event. This type of event is generated when the user presses down (until a click is felt) on the touch screen. Typically used to highlight or activate UI elements on the display.

See Also:
Constant Field Values
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 5.0.0

UNCLICK

public static final int UNCLICK
Touch screen unclick input event. This type of event is generated when the user releases from a click on the touchscreen. Typically used to activate UI elements on the display.

See Also:
Constant Field Values
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 5.0.0


Constructor Detail

EventInjector.TouchEvent

public EventInjector.TouchEvent(int event,
                                int x1,
                                int y1,
                                int x2,
                                int y2,
                                int time)
Creates a TouchEvent with a touch screen event code, coordinates of two touch (finger) points, and time. Specifying a non-existent first touch point and a valid second touch point will result in an IllegalArgumentException being thrown. Corresponding x and y coordinates need to be of the same sign.

Parameters:
event - One of the following touchscreen event codes: EventInjector.TouchEvent.DOWN, EventInjector.TouchEvent.UP, EventInjector.TouchEvent.MOVE, EventInjector.TouchEvent.CLICK, EventInjector.TouchEvent.UNCLICK,
x1 - X coordinate of the first touch point. Set to -1 if it does not exist. Cannot be less than -1 or greater than screen width.
y1 - Y coordinate of the first touch point. Set to -1 if it does not exist. Cannot be less than -1 or greater than screen height.
x2 - X coordinate of the second touch point. Set to -1 if it does not exist. Cannot be less than -1 or greater than screen width.
y2 - Y coordinate of the second touch point. Set to -1 if it does not exist. Cannot be less than -1 or greater than screen height.
time - Ticks in milliseconds. Set to -1 to apply system uptime.
Throws:
IllegalArgumentException - if event or coordinate values are invalid
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 5.0.0


Method Detail

injectSwipeGesture

public static void injectSwipeGesture(int originX,
                                      int originY,
                                      EventInjector.TouchEvent[] moveEvents)
Injects a swipe gesture.

Parameters:
originX - Origin X coordinate. Cannot be less than 0 and cannot be greater than screen width.
originY - Origin Y coordinate. Cannot be less than 0 and cannot be greater than screen height.
moveEvents - An array of move events. Specify null if no move events desired as part of the gesture.
Throws:
IllegalArgumentException - if coordinate values are invalid
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 5.0.0

injectTapGesture

public static void injectTapGesture(int x,
                                    int y,
                                    int taps)
Injects a tap or multi tap sequence.

Parameters:
x - X coordinate of the first touch point. Cannot be less than 0 and cannot be greater than screen width.
y - Y coordinate of the first touch point. Cannot be less than 0 and cannot be greater than screen height.
taps - Indicates number of taps to inject. Must be 1 or greater.
Throws:
IllegalArgumentException - if coordinate or taps values are invalid
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 5.0.0

injectTwoFingerTap

public static void injectTwoFingerTap(int x1,
                                      int y1,
                                      int x2,
                                      int y2,
                                      int touchPoint)
Injects a two finger TAP gesture associating the TAP with either the first or second touch point.

Parameters:
x1 - X coordinate of the first touch point. Cannot be less than 0 and cannot be greater than screen width.
y1 - Y coordinate of the first touch point Cannot be less than 0 and cannot be greater than screen height.
x2 - X coordinate of the second touch point Cannot be less than 0 and cannot be greater than screen width.
y2 - Y coordinate of the second touch point Cannot be less than 0 and cannot be greater than screen height.
touchPoint - Indicates the touchPoint with which to associate the TAP gesture. Must be 1 or 2.
Throws:
IllegalArgumentException - if coordinate or touch point values are invalid
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 5.0.0

invokeClickThrough

public static final void invokeClickThrough(int x1,
                                            int y1,
                                            int x2,
                                            int y2)
Creates and invokes the sequence of events (DOWN, CLICK, UNCLICK, UP) which form a click-through. It is possible to associate a CLICK/UNCLICK sequence with a second touch point. In this case you need to inject a DOWN event (specifying the first touch point), then call this method specifying a second touch point, and finally inject an UP event (specifying the first touch point). Corresponding x and y coordinates of differing signs will result in an IllegalArgumentException.

Parameters:
x1 - X coordinate of the first touch point. Cannot be less than -1 or greater than screen width. Set to -1 if it does not exist.
y1 - Y coordinate of the first touch point. Cannot be less than -1 or greater than screen height. Set to -1 if it does not exist.
x2 - X coordinate of the second touch point. Cannot be less than -1 or greater than screen width. Set to -1 if it does not exist.
y2 - Y coordinate of the second touch point. Cannot be less than -1 or greater than screen height. Set to -1 if it does not exist.
Throws:
IllegalArgumentException - if coordinate values are invalid
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 5.0.0

setPoint1

public void setPoint1(int x1,
                      int y1)
Sets coordinates for the first touch point. An IllegalArgumentException will be thrown if the coordinates have different signs, either is less than -1, are greater than screen dimensions, or if coordinates are set to -1 while second touch point coordinates are greater than -1.

Parameters:
x1 - X coordinate of the first touch point. Set to -1 if it does not exist. Cannot be less than -1 or greater than screen width.
y1 - Y coordinate of the first touch point. Set to -1 if it does not exist. Cannot be less than -1 or greater than screen height.
Throws:
IllegalArgumentException - if coordinate values are invalid
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 5.0.0

setPoint2

public void setPoint2(int x2,
                      int y2)
Sets coordinates for the second touch point. An IllegalArgumentException will be thrown if the coordinates have different signs, either is less than -1, or are greater than screen dimensions. An IllegalStateException will be thrown if this method is called with positive arguments while first touch point exists and event is not MOVE.

Parameters:
x2 - X coordinate of the second touch point. Set to -1 if it does not exist. Cannot be less than -1 or greater than screen width.
y2 - Y coordinate of the second touch point. Set to -1 if it does not exist. Cannot be less than -1 or greater than screen width.
Throws:
IllegalArgumentException - if coordinate values are invalid or if this method is called with positive arguments while first touch point exists and event = MOVE.
IllegalStateException - if this method is called with positive arguments while first touch point exists and event is not MOVE.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 5.0.0

getPoint1X

public int getPoint1X()
Returns the x coordinate for the first touch point.

Returns:
X coordinate for the first touch point.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 5.0.0

getPoint1Y

public int getPoint1Y()
Returns the y coordinate for the first touch point.

Returns:
Y coordinate for the first touch point.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 5.0.0

getPoint2X

public int getPoint2X()
Returns the x coordinate for the second touch point.

Returns:
X coordinate for the second touch point.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 5.0.0

getPoint2Y

public int getPoint2Y()
Returns the y coordinate for the second touch point.

Returns:
Y coordinate for the second touch point.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 5.0.0





Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal