Example usage for Java android.view MotionEvent fields, constructors, methods, implement or subclass
The text is from its open source code.
int | INVALID_POINTER_ID An invalid pointer id. |
int | ACTION_MASK Bit mask of the parts of the action code that are the action itself. |
int | ACTION_DOWN Constant for #getActionMasked : A pressed gesture has started, the motion contains the initial starting location. |
int | ACTION_UP Constant for #getActionMasked : A pressed gesture has finished, the motion contains the final release location as well as any intermediate points since the last down or move event. |
int | ACTION_MOVE Constant for #getActionMasked : A change has happened during a press gesture (between #ACTION_DOWN and #ACTION_UP ). |
int | ACTION_CANCEL Constant for #getActionMasked : The current gesture has been aborted. |
int | ACTION_OUTSIDE Constant for #getActionMasked : A movement has happened outside of the normal bounds of the UI element. |
int | ACTION_POINTER_DOWN Constant for #getActionMasked : A non-primary pointer has gone down. |
int | ACTION_POINTER_UP Constant for #getActionMasked : A non-primary pointer has gone up. |
int | ACTION_HOVER_MOVE Constant for #getActionMasked : A change happened but the pointer is not down (unlike #ACTION_MOVE ). |
int | ACTION_SCROLL Constant for #getActionMasked : The motion event contains relative vertical and/or horizontal scroll offsets. |
int | ACTION_HOVER_ENTER Constant for #getActionMasked : The pointer is not down but has entered the boundaries of a window or view. |
int | ACTION_HOVER_EXIT Constant for #getActionMasked : The pointer is not down but has exited the boundaries of a window or view. |
int | ACTION_BUTTON_PRESS Constant for #getActionMasked : A button has been pressed. |
int | ACTION_POINTER_INDEX_MASK Bits in the action code that represent a pointer index, used with #ACTION_POINTER_DOWN and #ACTION_POINTER_UP . |
int | ACTION_POINTER_INDEX_SHIFT Bit shift for the action bits holding the pointer index as defined by #ACTION_POINTER_INDEX_MASK . |
int | ACTION_POINTER_1_DOWN |
int | ACTION_POINTER_2_DOWN |
int | ACTION_POINTER_1_UP |
int | ACTION_POINTER_2_UP |
int | ACTION_POINTER_3_UP |
int | ACTION_POINTER_ID_MASK |
int | ACTION_POINTER_ID_SHIFT |
int | AXIS_X Axis constant: X axis of a motion event. |
int | AXIS_Y Axis constant: Y axis of a motion event. |
int | AXIS_VSCROLL Axis constant: Vertical Scroll axis of a motion event. |
int | AXIS_HSCROLL Axis constant: Horizontal Scroll axis of a motion event. |
int | AXIS_Z Axis constant: Z axis of a motion event. |
int | AXIS_RX Axis constant: X Rotation axis of a motion event. |
int | AXIS_RY Axis constant: Y Rotation axis of a motion event. |
int | AXIS_RZ Axis constant: Z Rotation axis of a motion event. |
int | AXIS_HAT_X Axis constant: Hat X axis of a motion event. |
int | AXIS_HAT_Y Axis constant: Hat Y axis of a motion event. |
int | AXIS_LTRIGGER Axis constant: Left Trigger axis of a motion event. |
int | AXIS_RTRIGGER Axis constant: Right Trigger axis of a motion event. |
int | AXIS_GAS Axis constant: Gas axis of a motion event. |
int | AXIS_BRAKE Axis constant: Brake axis of a motion event. |
int | BUTTON_PRIMARY Button constant: Primary button (left mouse button). |
int | BUTTON_SECONDARY Button constant: Secondary button (right mouse button). |
int | BUTTON_TERTIARY Button constant: Tertiary button (middle mouse button). |
int | BUTTON_STYLUS_PRIMARY Button constant: Primary stylus button pressed. |
int | BUTTON_STYLUS_SECONDARY Button constant: Secondary stylus button pressed. |
int | TOOL_TYPE_FINGER Tool type constant: The tool is a finger. |
int | TOOL_TYPE_STYLUS Tool type constant: The tool is a stylus. |
int | TOOL_TYPE_MOUSE Tool type constant: The tool is a mouse or trackpad. |
String | actionToString(int action) Returns a string that represents the symbolic name of the specified unmasked action such as "ACTION_DOWN", "ACTION_POINTER_DOWN(3)" or an equivalent numeric constant such as "35" if unknown. |
String | axisToString(int axis) Returns a string that represents the symbolic name of the specified axis such as "AXIS_X" or an equivalent numeric constant such as "42" if unknown. |
boolean | equals(Object obj) Indicates whether some other object is "equal to" this one. |
int | findPointerIndex(int pointerId) Given a pointer identifier, find the index of its data in the event. |
int | getAction() Return the kind of action being performed. |
int | getActionIndex() For #ACTION_POINTER_DOWN or #ACTION_POINTER_UP as returned by #getActionMasked , this returns the associated pointer index. |
int | getActionMasked() Return the masked action being performed, without pointer index information. |
float | getAxisValue(int axis) #getAxisValue(int) for the first pointer index (may be an arbitrary pointer identifier). |
int | getButtonState() Gets the state of all buttons that are pressed such as a mouse or stylus button. |
Class> | getClass() Returns the runtime class of this Object . |
InputDevice | getDevice() Gets the device that this event came from. |
int | getDeviceId() |
long | getDownTime() Returns the time (in ms) when the user originally pressed down to start a stream of position events. |
int | getEdgeFlags() Returns a bitfield indicating which edges, if any, were touched by this MotionEvent. |
long | getEventTime() Retrieve the time this event occurred, in the android.os.SystemClock#uptimeMillis time base. |
int | getFlags() Gets the motion event flags. |
float | getHistoricalAxisValue(int axis, int pos) #getHistoricalAxisValue(int,int,int) for the first pointer index (may be an arbitrary pointer identifier). |
long | getHistoricalEventTime(int pos) Returns the time that a historical movement occurred between this event and the previous event, in the android.os.SystemClock#uptimeMillis time base. |
float | getHistoricalPressure(int pointerIndex, int pos) Returns a historical pressure coordinate, as per #getPressure(int) , that occurred between this event and the previous event for the given pointer. |
float | getHistoricalPressure(int pos) #getHistoricalPressure(int,int) for the first pointer index (may be an arbitrary pointer identifier). |
float | getHistoricalSize(int pointerIndex, int pos) Returns a historical size coordinate, as per #getSize(int) , that occurred between this event and the previous event for the given pointer. |
float | getHistoricalSize(int pos) #getHistoricalSize(int,int) for the first pointer index (may be an arbitrary pointer identifier). |
float | getHistoricalX(int pos) #getHistoricalX(int,int) for the first pointer index (may be an arbitrary pointer identifier). |
float | getHistoricalX(int pointerIndex, int pos) Returns a historical X coordinate, as per #getX(int) , that occurred between this event and the previous event for the given pointer. |
float | getHistoricalY(int pos) #getHistoricalY(int,int) for the first pointer index (may be an arbitrary pointer identifier). |
float | getHistoricalY(int pointerIndex, int pos) Returns a historical Y coordinate, as per #getY(int) , that occurred between this event and the previous event for the given pointer. |
int | getHistorySize() Returns the number of historical points in this event. |
int | getMetaState() Returns the state of any meta / modifier keys that were in effect when the event was generated. |
float | getOrientation(int pointerIndex) Returns the orientation of the touch area and tool area in radians clockwise from vertical for the given pointer index (use #getPointerId(int) to find the pointer identifier for this index). |
void | getPointerCoords(int pointerIndex, PointerCoords outPointerCoords) Populates a PointerCoords object with pointer coordinate data for the specified pointer index. |
int | getPointerCount() The number of pointers of data contained in this event. |
int | getPointerId(int pointerIndex) Return the pointer identifier associated with a particular pointer data index in this event. |
void | getPointerProperties(int pointerIndex, PointerProperties outPointerProperties) Populates a PointerProperties object with pointer properties for the specified pointer index. |
float | getPressure(int pointerIndex) Returns the current pressure of this event for the given pointer index (use #getPointerId(int) to find the pointer identifier for this index). |
float | getPressure() #getPressure(int) for the first pointer index (may be an arbitrary pointer identifier). |
float | getRawX() Returns the original raw X coordinate of this event. |
float | getRawY() Returns the original raw Y coordinate of this event. |
float | getSize(int pointerIndex) Returns a scaled value of the approximate size for the given pointer index (use #getPointerId(int) to find the pointer identifier for this index). |
float | getSize() #getSize(int) for the first pointer index (may be an arbitrary pointer identifier). |
int | getSource() |
float | getToolMajor(int pointerIndex) Returns the length of the major axis of an ellipse that describes the size of the approaching tool for the given pointer index (use #getPointerId(int) to find the pointer identifier for this index). |
float | getToolMinor(int pointerIndex) Returns the length of the minor axis of an ellipse that describes the size of the approaching tool for the given pointer index (use #getPointerId(int) to find the pointer identifier for this index). |
int | getToolType(int pointerIndex) Gets the tool type of a pointer for the given pointer index. |
float | getTouchMajor(int pointerIndex) Returns the length of the major axis of an ellipse that describes the touch area at the point of contact for the given pointer index (use #getPointerId(int) to find the pointer identifier for this index). |
float | getTouchMinor(int pointerIndex) Returns the length of the minor axis of an ellipse that describes the touch area at the point of contact for the given pointer index (use #getPointerId(int) to find the pointer identifier for this index). |
float | getX(int pointerIndex) Returns the X coordinate of this event for the given pointer index (use #getPointerId(int) to find the pointer identifier for this index). |
float | getX() #getX(int) for the first pointer index (may be an arbitrary pointer identifier). |
float | getXPrecision() Return the precision of the X coordinates being reported. |
float | getY(int pointerIndex) Returns the Y coordinate of this event for the given pointer index (use #getPointerId(int) to find the pointer identifier for this index). |
float | getY() #getY(int) for the first pointer index (may be an arbitrary pointer identifier). |
float | getYPrecision() Return the precision of the Y coordinates being reported. |
boolean | isButtonPressed(int button) Checks if a mouse or stylus button (or combination of buttons) is pressed. |
MotionEvent | obtain(long downTime, long eventTime, int action, float x, float y, int metaState) Create a new MotionEvent, filling in a subset of the basic motion values. |
MotionEvent | obtain(long downTime, long eventTime, int action, int pointerCount, int[] pointerIds, PointerCoords[] pointerCoords, int metaState, float xPrecision, float yPrecision, int deviceId, int edgeFlags, int source, int flags) Create a new MotionEvent, filling in all of the basic values that define the motion. |
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) Create a new MotionEvent, filling in all of the basic values that define the motion. |
MotionEvent | obtain(MotionEvent other) Create a new MotionEvent, copying from an existing one. |
MotionEvent | obtain(long downTime, long eventTime, int action, int pointerCount, PointerProperties[] pointerProperties, PointerCoords[] pointerCoords, int metaState, int buttonState, float xPrecision, float yPrecision, int deviceId, int edgeFlags, int source, int flags) Create a new MotionEvent, filling in all of the basic values that define the motion. |
MotionEvent | obtainNoHistory(MotionEvent other) Create a new MotionEvent, copying from an existing one, but not including any historical point information. |
void | offsetLocation(float deltaX, float deltaY) Adjust this event's location. |
void | recycle() Recycle the MotionEvent, to be re-used by a later caller. |
void | setAction(int action) Sets this event's action. |
void | setLocation(float x, float y) Set this event's location. |
void | setSource(int source) |
String | toString() |
void | transform(Matrix matrix) Applies a transformation matrix to all of the points in the event. |