public final class TouchEvent
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
ACTION_DOWN
A pressed gesture has started, the touch event contains a valid location
of event.
|
static int |
ACTION_UP
A pressed gesture has finished, the touch event does not contains a valid
location.
|
Constructor and Description |
---|
TouchEvent(int x,
int y,
int pressure,
int elapse)
Constructs a
TouchEvent , filling in all of the basic values
that define the touch. |
Modifier and Type | Method and Description |
---|---|
int |
getAction()
Gets the kind of action being performed.
|
int |
getElapse()
Gets the time between this event and the previous one.
|
int |
getPressure()
Gets the current pressure of this event.
|
int |
getX()
Gets the X coordinate of this event.
|
int |
getY()
Gets the Y coordinate of this event.
|
static TouchEvent[] |
obtainArray(byte[] data)
Constructs a new instance of this class from a given byte array.
|
java.lang.String |
toString()
Returns the string representation of object.
|
public static final int ACTION_DOWN
public static final int ACTION_UP
public TouchEvent(int x, int y, int pressure, int elapse)
TouchEvent
, filling in all of the basic values
that define the touch.x
- the X coordinate of this event.y
- the Y coordinate of this event.pressure
- the current pressure of this event.elapse
- the time (in ms) between this event and the previous one.public static TouchEvent[] obtainArray(byte[] data)
Every touch event in array must be defined in block of 4 bytes, in format: X coordinate, Y coordinate, pressure, elapse (4 ms units).
If data
is null
, a NullPointerException
is
thrown.
If (data.length % 4) != 0
, a IllegalArgumentException
is
thrown.
data
- the byte array contains blocks with touch events.TouchEvent[]
.public int getX()
public int getY()
public int getPressure()
public int getElapse()
public int getAction()
ACTION_DOWN
or ACTION_UP
.public java.lang.String toString()
toString
in class java.lang.Object