android.view
Class MotionEvent

java.lang.Object
  extended by android.view.InputEvent
      extended by android.view.MotionEvent
All Implemented Interfaces:
Parcelable

public final class MotionEvent
extends InputEvent
implements Parcelable


Nested Class Summary
static class MotionEvent.PointerCoords
           
static class MotionEvent.PointerProperties
           
 
Nested classes/interfaces inherited from interface android.os.Parcelable
Parcelable.ClassLoaderCreator<T>, Parcelable.Creator<T>
 
Field Summary
static int ACTION_CANCEL
           
static int ACTION_DOWN
           
static int ACTION_HOVER_ENTER
           
static int ACTION_HOVER_EXIT
           
static int ACTION_HOVER_MOVE
           
static int ACTION_MASK
           
static int ACTION_MOVE
           
static int ACTION_OUTSIDE
           
static int ACTION_POINTER_1_DOWN
           
static int ACTION_POINTER_1_UP
           
static int ACTION_POINTER_2_DOWN
           
static int ACTION_POINTER_2_UP
           
static int ACTION_POINTER_3_DOWN
           
static int ACTION_POINTER_3_UP
           
static int ACTION_POINTER_DOWN
           
static int ACTION_POINTER_ID_MASK
           
static int ACTION_POINTER_ID_SHIFT
           
static int ACTION_POINTER_INDEX_MASK
           
static int ACTION_POINTER_INDEX_SHIFT
           
static int ACTION_POINTER_UP
           
static int ACTION_SCROLL
           
static int ACTION_UP
           
static int AXIS_BRAKE
           
static int AXIS_DISTANCE
           
static int AXIS_GAS
           
static int AXIS_GENERIC_1
           
static int AXIS_GENERIC_10
           
static int AXIS_GENERIC_11
           
static int AXIS_GENERIC_12
           
static int AXIS_GENERIC_13
           
static int AXIS_GENERIC_14
           
static int AXIS_GENERIC_15
           
static int AXIS_GENERIC_16
           
static int AXIS_GENERIC_2
           
static int AXIS_GENERIC_3
           
static int AXIS_GENERIC_4
           
static int AXIS_GENERIC_5
           
static int AXIS_GENERIC_6
           
static int AXIS_GENERIC_7
           
static int AXIS_GENERIC_8
           
static int AXIS_GENERIC_9
           
static int AXIS_HAT_X
           
static int AXIS_HAT_Y
           
static int AXIS_HSCROLL
           
static int AXIS_LTRIGGER
           
static int AXIS_ORIENTATION
           
static int AXIS_PRESSURE
           
static int AXIS_RTRIGGER
           
static int AXIS_RUDDER
           
static int AXIS_RX
           
static int AXIS_RY
           
static int AXIS_RZ
           
static int AXIS_SIZE
           
static int AXIS_THROTTLE
           
static int AXIS_TILT
           
static int AXIS_TOOL_MAJOR
           
static int AXIS_TOOL_MINOR
           
static int AXIS_TOUCH_MAJOR
           
static int AXIS_TOUCH_MINOR
           
static int AXIS_VSCROLL
           
static int AXIS_WHEEL
           
static int AXIS_X
           
static int AXIS_Y
           
static int AXIS_Z
           
static int BUTTON_BACK
           
static int BUTTON_FORWARD
           
static int BUTTON_PRIMARY
           
static int BUTTON_SECONDARY
           
static int BUTTON_TERTIARY
           
static Parcelable.Creator<MotionEvent> CREATOR
           
static int EDGE_BOTTOM
           
static int EDGE_LEFT
           
static int EDGE_RIGHT
           
static int EDGE_TOP
           
static int FLAG_WINDOW_IS_OBSCURED
           
static int INVALID_POINTER_ID
           
static int TOOL_TYPE_ERASER
           
static int TOOL_TYPE_FINGER
           
static int TOOL_TYPE_MOUSE
           
static int TOOL_TYPE_STYLUS
           
static int TOOL_TYPE_UNKNOWN
           
 
Fields inherited from interface android.os.Parcelable
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE
 
Method Summary
 void addBatch(long eventTime, float x, float y, float pressure, float size, int metaState)
           
 void addBatch(long eventTime, MotionEvent.PointerCoords[] pointerCoords, int metaState)
           
static int axisFromString(String symbolicName)
           
static String axisToString(int axis)
           
protected  void finalize()
           
 int findPointerIndex(int pointerId)
           
 int getAction()
           
 int getActionIndex()
           
 int getActionMasked()
           
 float getAxisValue(int axis)
           
 float getAxisValue(int axis, int pointerIndex)
           
 int getButtonState()
           
 int getDeviceId()
           
 long getDownTime()
           
 int getEdgeFlags()
           
 long getEventTime()
           
 int getFlags()
           
 float getHistoricalAxisValue(int axis, int pos)
           
 float getHistoricalAxisValue(int axis, int pointerIndex, int pos)
           
 long getHistoricalEventTime(int pos)
           
 float getHistoricalOrientation(int pos)
           
 float getHistoricalOrientation(int pointerIndex, int pos)
           
 void getHistoricalPointerCoords(int pointerIndex, int pos, MotionEvent.PointerCoords outPointerCoords)
           
 float getHistoricalPressure(int pos)
           
 float getHistoricalPressure(int pointerIndex, int pos)
           
 float getHistoricalSize(int pos)
           
 float getHistoricalSize(int pointerIndex, int pos)
           
 float getHistoricalToolMajor(int pos)
           
 float getHistoricalToolMajor(int pointerIndex, int pos)
           
 float getHistoricalToolMinor(int pos)
           
 float getHistoricalToolMinor(int pointerIndex, int pos)
           
 float getHistoricalTouchMajor(int pos)
           
 float getHistoricalTouchMajor(int pointerIndex, int pos)
           
 float getHistoricalTouchMinor(int pos)
           
 float getHistoricalTouchMinor(int pointerIndex, int pos)
           
 float getHistoricalX(int pos)
           
 float getHistoricalX(int pointerIndex, int pos)
           
 float getHistoricalY(int pos)
           
 float getHistoricalY(int pointerIndex, int pos)
           
 int getHistorySize()
           
 int getMetaState()
           
 float getOrientation()
           
 float getOrientation(int pointerIndex)
           
 void getPointerCoords(int pointerIndex, MotionEvent.PointerCoords outPointerCoords)
           
 int getPointerCount()
           
 int getPointerId(int pointerIndex)
           
 void getPointerProperties(int pointerIndex, MotionEvent.PointerProperties outPointerProperties)
           
 float getPressure()
           
 float getPressure(int pointerIndex)
           
 float getRawX()
           
 float getRawY()
           
 float getSize()
           
 float getSize(int pointerIndex)
           
 int getSource()
           
 float getToolMajor()
           
 float getToolMajor(int pointerIndex)
           
 float getToolMinor()
           
 float getToolMinor(int pointerIndex)
           
 int getToolType(int pointerIndex)
           
 float getTouchMajor()
           
 float getTouchMajor(int pointerIndex)
           
 float getTouchMinor()
           
 float getTouchMinor(int pointerIndex)
           
 float getX()
           
 float getX(int pointerIndex)
           
 float getXPrecision()
           
 float getY()
           
 float getY(int pointerIndex)
           
 float getYPrecision()
           
static MotionEvent obtain(long downTime, long eventTime, int action, float x, float y, float pressure, float size, int metaState, float xPrecision, float yPrecision, int deviceId, int edgeFlags)
           
static MotionEvent obtain(long downTime, long eventTime, int action, float x, float y, int metaState)
           
static MotionEvent obtain(long downTime, long eventTime, int action, int pointerCount, float x, float y, float pressure, float size, int metaState, float xPrecision, float yPrecision, int deviceId, int edgeFlags)
           
static MotionEvent obtain(long downTime, long eventTime, int action, int pointerCount, int[] pointerIds, MotionEvent.PointerCoords[] pointerCoords, int metaState, float xPrecision, float yPrecision, int deviceId, int edgeFlags, int source, int flags)
           
static MotionEvent obtain(long downTime, long eventTime, int action, int pointerCount, MotionEvent.PointerProperties[] pointerProperties, MotionEvent.PointerCoords[] pointerCoords, int metaState, int buttonState, float xPrecision, float yPrecision, int deviceId, int edgeFlags, int source, int flags)
           
static MotionEvent obtain(MotionEvent other)
           
static MotionEvent obtainNoHistory(MotionEvent other)
           
 void offsetLocation(float deltaX, float deltaY)
           
 void recycle()
           
 void setAction(int action)
           
 void setEdgeFlags(int flags)
           
 void setLocation(float x, float y)
           
 void setSource(int source)
           
 String toString()
           
 void transform(Matrix matrix)
           
 void writeToParcel(Parcel out, int flags)
           
 
Methods inherited from class android.view.InputEvent
describeContents, getDevice
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface android.os.Parcelable
describeContents
 

Field Detail

INVALID_POINTER_ID

public static final int INVALID_POINTER_ID
See Also:
Constant Field Values

ACTION_MASK

public static final int ACTION_MASK
See Also:
Constant Field Values

ACTION_DOWN

public static final int ACTION_DOWN
See Also:
Constant Field Values

ACTION_UP

public static final int ACTION_UP
See Also:
Constant Field Values

ACTION_MOVE

public static final int ACTION_MOVE
See Also:
Constant Field Values

ACTION_CANCEL

public static final int ACTION_CANCEL
See Also:
Constant Field Values

ACTION_OUTSIDE

public static final int ACTION_OUTSIDE
See Also:
Constant Field Values

ACTION_POINTER_DOWN

public static final int ACTION_POINTER_DOWN
See Also:
Constant Field Values

ACTION_POINTER_UP

public static final int ACTION_POINTER_UP
See Also:
Constant Field Values

ACTION_HOVER_MOVE

public static final int ACTION_HOVER_MOVE
See Also:
Constant Field Values

ACTION_SCROLL

public static final int ACTION_SCROLL
See Also:
Constant Field Values

ACTION_HOVER_ENTER

public static final int ACTION_HOVER_ENTER
See Also:
Constant Field Values

ACTION_HOVER_EXIT

public static final int ACTION_HOVER_EXIT
See Also:
Constant Field Values

ACTION_POINTER_INDEX_MASK

public static final int ACTION_POINTER_INDEX_MASK
See Also:
Constant Field Values

ACTION_POINTER_INDEX_SHIFT

public static final int ACTION_POINTER_INDEX_SHIFT
See Also:
Constant Field Values

ACTION_POINTER_1_DOWN

public static final int ACTION_POINTER_1_DOWN
See Also:
Constant Field Values

ACTION_POINTER_2_DOWN

public static final int ACTION_POINTER_2_DOWN
See Also:
Constant Field Values

ACTION_POINTER_3_DOWN

public static final int ACTION_POINTER_3_DOWN
See Also:
Constant Field Values

ACTION_POINTER_1_UP

public static final int ACTION_POINTER_1_UP
See Also:
Constant Field Values

ACTION_POINTER_2_UP

public static final int ACTION_POINTER_2_UP
See Also:
Constant Field Values

ACTION_POINTER_3_UP

public static final int ACTION_POINTER_3_UP
See Also:
Constant Field Values

ACTION_POINTER_ID_MASK

public static final int ACTION_POINTER_ID_MASK
See Also:
Constant Field Values

ACTION_POINTER_ID_SHIFT

public static final int ACTION_POINTER_ID_SHIFT
See Also:
Constant Field Values

FLAG_WINDOW_IS_OBSCURED

public static final int FLAG_WINDOW_IS_OBSCURED
See Also:
Constant Field Values

EDGE_TOP

public static final int EDGE_TOP
See Also:
Constant Field Values

EDGE_BOTTOM

public static final int EDGE_BOTTOM
See Also:
Constant Field Values

EDGE_LEFT

public static final int EDGE_LEFT
See Also:
Constant Field Values

EDGE_RIGHT

public static final int EDGE_RIGHT
See Also:
Constant Field Values

AXIS_X

public static final int AXIS_X
See Also:
Constant Field Values

AXIS_Y

public static final int AXIS_Y
See Also:
Constant Field Values

AXIS_PRESSURE

public static final int AXIS_PRESSURE
See Also:
Constant Field Values

AXIS_SIZE

public static final int AXIS_SIZE
See Also:
Constant Field Values

AXIS_TOUCH_MAJOR

public static final int AXIS_TOUCH_MAJOR
See Also:
Constant Field Values

AXIS_TOUCH_MINOR

public static final int AXIS_TOUCH_MINOR
See Also:
Constant Field Values

AXIS_TOOL_MAJOR

public static final int AXIS_TOOL_MAJOR
See Also:
Constant Field Values

AXIS_TOOL_MINOR

public static final int AXIS_TOOL_MINOR
See Also:
Constant Field Values

AXIS_ORIENTATION

public static final int AXIS_ORIENTATION
See Also:
Constant Field Values

AXIS_VSCROLL

public static final int AXIS_VSCROLL
See Also:
Constant Field Values

AXIS_HSCROLL

public static final int AXIS_HSCROLL
See Also:
Constant Field Values

AXIS_Z

public static final int AXIS_Z
See Also:
Constant Field Values

AXIS_RX

public static final int AXIS_RX
See Also:
Constant Field Values

AXIS_RY

public static final int AXIS_RY
See Also:
Constant Field Values

AXIS_RZ

public static final int AXIS_RZ
See Also:
Constant Field Values

AXIS_HAT_X

public static final int AXIS_HAT_X
See Also:
Constant Field Values

AXIS_HAT_Y

public static final int AXIS_HAT_Y
See Also:
Constant Field Values

AXIS_LTRIGGER

public static final int AXIS_LTRIGGER
See Also:
Constant Field Values

AXIS_RTRIGGER

public static final int AXIS_RTRIGGER
See Also:
Constant Field Values

AXIS_THROTTLE

public static final int AXIS_THROTTLE
See Also:
Constant Field Values

AXIS_RUDDER

public static final int AXIS_RUDDER
See Also:
Constant Field Values

AXIS_WHEEL

public static final int AXIS_WHEEL
See Also:
Constant Field Values

AXIS_GAS

public static final int AXIS_GAS
See Also:
Constant Field Values

AXIS_BRAKE

public static final int AXIS_BRAKE
See Also:
Constant Field Values

AXIS_DISTANCE

public static final int AXIS_DISTANCE
See Also:
Constant Field Values

AXIS_TILT

public static final int AXIS_TILT
See Also:
Constant Field Values

AXIS_GENERIC_1

public static final int AXIS_GENERIC_1
See Also:
Constant Field Values

AXIS_GENERIC_2

public static final int AXIS_GENERIC_2
See Also:
Constant Field Values

AXIS_GENERIC_3

public static final int AXIS_GENERIC_3
See Also:
Constant Field Values

AXIS_GENERIC_4

public static final int AXIS_GENERIC_4
See Also:
Constant Field Values

AXIS_GENERIC_5

public static final int AXIS_GENERIC_5
See Also:
Constant Field Values

AXIS_GENERIC_6

public static final int AXIS_GENERIC_6
See Also:
Constant Field Values

AXIS_GENERIC_7

public static final int AXIS_GENERIC_7
See Also:
Constant Field Values

AXIS_GENERIC_8

public static final int AXIS_GENERIC_8
See Also:
Constant Field Values

AXIS_GENERIC_9

public static final int AXIS_GENERIC_9
See Also:
Constant Field Values

AXIS_GENERIC_10

public static final int AXIS_GENERIC_10
See Also:
Constant Field Values

AXIS_GENERIC_11

public static final int AXIS_GENERIC_11
See Also:
Constant Field Values

AXIS_GENERIC_12

public static final int AXIS_GENERIC_12
See Also:
Constant Field Values

AXIS_GENERIC_13

public static final int AXIS_GENERIC_13
See Also:
Constant Field Values

AXIS_GENERIC_14

public static final int AXIS_GENERIC_14
See Also:
Constant Field Values

AXIS_GENERIC_15

public static final int AXIS_GENERIC_15
See Also:
Constant Field Values

AXIS_GENERIC_16

public static final int AXIS_GENERIC_16
See Also:
Constant Field Values

BUTTON_PRIMARY

public static final int BUTTON_PRIMARY
See Also:
Constant Field Values

BUTTON_SECONDARY

public static final int BUTTON_SECONDARY
See Also:
Constant Field Values

BUTTON_TERTIARY

public static final int BUTTON_TERTIARY
See Also:
Constant Field Values

BUTTON_BACK

public static final int BUTTON_BACK
See Also:
Constant Field Values

BUTTON_FORWARD

public static final int BUTTON_FORWARD
See Also:
Constant Field Values

TOOL_TYPE_UNKNOWN

public static final int TOOL_TYPE_UNKNOWN
See Also:
Constant Field Values

TOOL_TYPE_FINGER

public static final int TOOL_TYPE_FINGER
See Also:
Constant Field Values

TOOL_TYPE_STYLUS

public static final int TOOL_TYPE_STYLUS
See Also:
Constant Field Values

TOOL_TYPE_MOUSE

public static final int TOOL_TYPE_MOUSE
See Also:
Constant Field Values

TOOL_TYPE_ERASER

public static final int TOOL_TYPE_ERASER
See Also:
Constant Field Values

CREATOR

public static final Parcelable.Creator<MotionEvent> CREATOR
Method Detail

finalize

protected void finalize()
                 throws Throwable
Overrides:
finalize in class Object
Throws:
Throwable

obtain

public static MotionEvent obtain(long downTime,
                                 long eventTime,
                                 int action,
                                 int pointerCount,
                                 MotionEvent.PointerProperties[] pointerProperties,
                                 MotionEvent.PointerCoords[] pointerCoords,
                                 int metaState,
                                 int buttonState,
                                 float xPrecision,
                                 float yPrecision,
                                 int deviceId,
                                 int edgeFlags,
                                 int source,
                                 int flags)

obtain

public static MotionEvent obtain(long downTime,
                                 long eventTime,
                                 int action,
                                 int pointerCount,
                                 int[] pointerIds,
                                 MotionEvent.PointerCoords[] pointerCoords,
                                 int metaState,
                                 float xPrecision,
                                 float yPrecision,
                                 int deviceId,
                                 int edgeFlags,
                                 int source,
                                 int flags)

obtain

public static MotionEvent obtain(long downTime,
                                 long eventTime,
                                 int action,
                                 float x,
                                 float y,
                                 float pressure,
                                 float size,
                                 int metaState,
                                 float xPrecision,
                                 float yPrecision,
                                 int deviceId,
                                 int edgeFlags)

obtain

public static MotionEvent obtain(long downTime,
                                 long eventTime,
                                 int action,
                                 int pointerCount,
                                 float x,
                                 float y,
                                 float pressure,
                                 float size,
                                 int metaState,
                                 float xPrecision,
                                 float yPrecision,
                                 int deviceId,
                                 int edgeFlags)

obtain

public static MotionEvent obtain(long downTime,
                                 long eventTime,
                                 int action,
                                 float x,
                                 float y,
                                 int metaState)

obtain

public static MotionEvent obtain(MotionEvent other)

obtainNoHistory

public static MotionEvent obtainNoHistory(MotionEvent other)

recycle

public final void recycle()

getDeviceId

public final int getDeviceId()
Specified by:
getDeviceId in class InputEvent

getSource

public final int getSource()
Specified by:
getSource in class InputEvent

setSource

public final void setSource(int source)

getAction

public final int getAction()

getActionMasked

public final int getActionMasked()

getActionIndex

public final int getActionIndex()

getFlags

public final int getFlags()

getDownTime

public final long getDownTime()

getEventTime

public final long getEventTime()

getX

public final float getX()

getY

public final float getY()

getPressure

public final float getPressure()

getSize

public final float getSize()

getTouchMajor

public final float getTouchMajor()

getTouchMinor

public final float getTouchMinor()

getToolMajor

public final float getToolMajor()

getToolMinor

public final float getToolMinor()

getOrientation

public final float getOrientation()

getAxisValue

public final float getAxisValue(int axis)

getPointerCount

public final int getPointerCount()

getPointerId

public final int getPointerId(int pointerIndex)

getToolType

public final int getToolType(int pointerIndex)

findPointerIndex

public final int findPointerIndex(int pointerId)

getX

public final float getX(int pointerIndex)

getY

public final float getY(int pointerIndex)

getPressure

public final float getPressure(int pointerIndex)

getSize

public final float getSize(int pointerIndex)

getTouchMajor

public final float getTouchMajor(int pointerIndex)

getTouchMinor

public final float getTouchMinor(int pointerIndex)

getToolMajor

public final float getToolMajor(int pointerIndex)

getToolMinor

public final float getToolMinor(int pointerIndex)

getOrientation

public final float getOrientation(int pointerIndex)

getAxisValue

public final float getAxisValue(int axis,
                                int pointerIndex)

getPointerCoords

public final void getPointerCoords(int pointerIndex,
                                   MotionEvent.PointerCoords outPointerCoords)

getPointerProperties

public final void getPointerProperties(int pointerIndex,
                                       MotionEvent.PointerProperties outPointerProperties)

getMetaState

public final int getMetaState()

getButtonState

public final int getButtonState()

getRawX

public final float getRawX()

getRawY

public final float getRawY()

getXPrecision

public final float getXPrecision()

getYPrecision

public final float getYPrecision()

getHistorySize

public final int getHistorySize()

getHistoricalEventTime

public final long getHistoricalEventTime(int pos)

getHistoricalX

public final float getHistoricalX(int pos)

getHistoricalY

public final float getHistoricalY(int pos)

getHistoricalPressure

public final float getHistoricalPressure(int pos)

getHistoricalSize

public final float getHistoricalSize(int pos)

getHistoricalTouchMajor

public final float getHistoricalTouchMajor(int pos)

getHistoricalTouchMinor

public final float getHistoricalTouchMinor(int pos)

getHistoricalToolMajor

public final float getHistoricalToolMajor(int pos)

getHistoricalToolMinor

public final float getHistoricalToolMinor(int pos)

getHistoricalOrientation

public final float getHistoricalOrientation(int pos)

getHistoricalAxisValue

public final float getHistoricalAxisValue(int axis,
                                          int pos)

getHistoricalX

public final float getHistoricalX(int pointerIndex,
                                  int pos)

getHistoricalY

public final float getHistoricalY(int pointerIndex,
                                  int pos)

getHistoricalPressure

public final float getHistoricalPressure(int pointerIndex,
                                         int pos)

getHistoricalSize

public final float getHistoricalSize(int pointerIndex,
                                     int pos)

getHistoricalTouchMajor

public final float getHistoricalTouchMajor(int pointerIndex,
                                           int pos)

getHistoricalTouchMinor

public final float getHistoricalTouchMinor(int pointerIndex,
                                           int pos)

getHistoricalToolMajor

public final float getHistoricalToolMajor(int pointerIndex,
                                          int pos)

getHistoricalToolMinor

public final float getHistoricalToolMinor(int pointerIndex,
                                          int pos)

getHistoricalOrientation

public final float getHistoricalOrientation(int pointerIndex,
                                            int pos)

getHistoricalAxisValue

public final float getHistoricalAxisValue(int axis,
                                          int pointerIndex,
                                          int pos)

getHistoricalPointerCoords

public final void getHistoricalPointerCoords(int pointerIndex,
                                             int pos,
                                             MotionEvent.PointerCoords outPointerCoords)

getEdgeFlags

public final int getEdgeFlags()

setEdgeFlags

public final void setEdgeFlags(int flags)

setAction

public final void setAction(int action)

offsetLocation

public final void offsetLocation(float deltaX,
                                 float deltaY)

setLocation

public final void setLocation(float x,
                              float y)

transform

public final void transform(Matrix matrix)

addBatch

public final void addBatch(long eventTime,
                           float x,
                           float y,
                           float pressure,
                           float size,
                           int metaState)

addBatch

public final void addBatch(long eventTime,
                           MotionEvent.PointerCoords[] pointerCoords,
                           int metaState)

toString

public String toString()
Overrides:
toString in class Object

axisToString

public static String axisToString(int axis)

axisFromString

public static int axisFromString(String symbolicName)

writeToParcel

public void writeToParcel(Parcel out,
                          int flags)
Specified by:
writeToParcel in interface Parcelable


Copyright © 2008-2012. All Rights Reserved.