Please note that the contents of this offline web site may be out of date. To access the most recent documentation visit the online version .
Note that links that point to online resources are green in color and will open in a new window.
We would love it if you could give us feedback about this material by filling this form (You have to be online to fill it)
Android APIs
public class

MotionEventCompat

extends Object
java.lang.Object
   ↳ android.support.v4.view.MotionEventCompat

Class Overview

Helper for accessing features in MotionEvent introduced after API level 4 in a backwards compatible fashion.

Summary

Constants
int ACTION_HOVER_ENTER Constant for getActionMasked(MotionEvent) : The pointer is not down but has entered the boundaries of a window or view.
int ACTION_HOVER_EXIT Constant for getActionMasked(MotionEvent) : The pointer is not down but has exited the boundaries of a window or view.
int ACTION_HOVER_MOVE Synonym for ACTION_HOVER_MOVE .
int ACTION_MASK Synonym for ACTION_MASK .
int ACTION_POINTER_DOWN Synonym for ACTION_POINTER_DOWN .
int ACTION_POINTER_INDEX_MASK Synonym for ACTION_POINTER_INDEX_MASK .
int ACTION_POINTER_INDEX_SHIFT Synonym for ACTION_POINTER_INDEX_SHIFT .
int ACTION_POINTER_UP Synonym for ACTION_POINTER_UP .
int ACTION_SCROLL Synonym for ACTION_SCROLL .
Public Constructors
MotionEventCompat ()
Public Methods
static int findPointerIndex ( MotionEvent event, int pointerId)
static int getActionIndex ( MotionEvent event)
Call getAction() , returning only the pointer index portion
static int getActionMasked ( MotionEvent event)
Call getAction() , returning only the ACTION_MASK portion.
static int getPointerCount ( MotionEvent event)
The number of pointers of data contained in this event.
static int getPointerId ( MotionEvent event, int pointerIndex)
static float getX ( MotionEvent event, int pointerIndex)
static float getY ( MotionEvent event, int pointerIndex)
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final int ACTION_HOVER_ENTER

Constant for getActionMasked(MotionEvent) : The pointer is not down but has entered the boundaries of a window or view.

This action is always delivered to the window or view under the pointer.

This action is not a touch event so it is delivered to onGenericMotionEvent(MotionEvent) rather than onTouchEvent(MotionEvent) .

Constant Value: 9 (0x00000009)

public static final int ACTION_HOVER_EXIT

Constant for getActionMasked(MotionEvent) : The pointer is not down but has exited the boundaries of a window or view.

This action is always delivered to the window or view that was previously under the pointer.

This action is not a touch event so it is delivered to onGenericMotionEvent(MotionEvent) rather than onTouchEvent(MotionEvent) .

Constant Value: 10 (0x0000000a)

public static final int ACTION_HOVER_MOVE

Synonym for ACTION_HOVER_MOVE .

Constant Value: 7 (0x00000007)

public static final int ACTION_MASK

Synonym for ACTION_MASK .

Constant Value: 255 (0x000000ff)

public static final int ACTION_POINTER_DOWN

Synonym for ACTION_POINTER_DOWN .

Constant Value: 5 (0x00000005)

public static final int ACTION_POINTER_INDEX_MASK

Constant Value: 65280 (0x0000ff00)

public static final int ACTION_POINTER_INDEX_SHIFT

Constant Value: 8 (0x00000008)

public static final int ACTION_POINTER_UP

Synonym for ACTION_POINTER_UP .

Constant Value: 6 (0x00000006)

public static final int ACTION_SCROLL

Synonym for ACTION_SCROLL .

Constant Value: 8 (0x00000008)

Public Constructors

public MotionEventCompat ()

Public Methods

public static int findPointerIndex ( MotionEvent event, int pointerId)

Call findPointerIndex(int) . If running on a pre- ECLAIR device, does nothing and returns -1.

public static int getActionIndex ( MotionEvent event)

Call getAction() , returning only the pointer index portion

public static int getActionMasked ( MotionEvent event)

Call getAction() , returning only the ACTION_MASK portion.

public static int getPointerCount ( MotionEvent event)

The number of pointers of data contained in this event. Always >= 1.

public static int getPointerId ( MotionEvent event, int pointerIndex)

Call getPointerId(int) . If running on a pre- ECLAIR device, IndexOutOfBoundsException is thrown.

public static float getX ( MotionEvent event, int pointerIndex)

Call getX(int) . If running on a pre- ECLAIR device, IndexOutOfBoundsException is thrown.

public static float getY ( MotionEvent event, int pointerIndex)

Call getY(int) . If running on a pre- ECLAIR device, IndexOutOfBoundsException is thrown.