android.support.v4.view
Class MotionEventCompat

java.lang.Object
  extended by android.support.v4.view.MotionEventCompat

public class MotionEventCompat
extends java.lang.Object

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


Field Summary
static int ACTION_HOVER_ENTER
          Constant for getActionMasked(MotionEvent): The pointer is not down but has entered the boundaries of a window or view.
static int ACTION_HOVER_EXIT
          Constant for getActionMasked(MotionEvent): The pointer is not down but has exited the boundaries of a window or view.
static int ACTION_HOVER_MOVE
          Synonym for MotionEvent#ACTION_HOVER_MOVE.
static int ACTION_MASK
          Synonym for MotionEvent#ACTION_MASK.
static int ACTION_POINTER_DOWN
          Synonym for MotionEvent#ACTION_POINTER_DOWN.
static int ACTION_POINTER_INDEX_MASK
          Synonym for MotionEvent#ACTION_POINTER_INDEX_MASK.
static int ACTION_POINTER_INDEX_SHIFT
          Synonym for MotionEvent#ACTION_POINTER_INDEX_SHIFT.
static int ACTION_POINTER_UP
          Synonym for MotionEvent#ACTION_POINTER_UP.
static int ACTION_SCROLL
          Synonym for MotionEvent#ACTION_SCROLL.
 
Constructor Summary
MotionEventCompat()
           
 
Method Summary
static int findPointerIndex(MotionEvent event, int pointerId)
          Call MotionEvent#findPointerIndex(int).
static int getActionIndex(MotionEvent event)
          Call MotionEvent#getAction, returning only the pointer index portion
static int getActionMasked(MotionEvent event)
          Call MotionEvent#getAction, returning only the ACTION_MASK portion.
static int getPointerId(MotionEvent event, int pointerIndex)
          Call MotionEvent#getPointerId(int).
static float getX(MotionEvent event, int pointerIndex)
          Call MotionEvent#getX(int).
static float getY(MotionEvent event, int pointerIndex)
          Call MotionEvent#getY(int).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ACTION_MASK

public static final int ACTION_MASK
Synonym for MotionEvent#ACTION_MASK.

See Also:
Constant Field Values

ACTION_POINTER_DOWN

public static final int ACTION_POINTER_DOWN
Synonym for MotionEvent#ACTION_POINTER_DOWN.

See Also:
Constant Field Values

ACTION_POINTER_UP

public static final int ACTION_POINTER_UP
Synonym for MotionEvent#ACTION_POINTER_UP.

See Also:
Constant Field Values

ACTION_HOVER_MOVE

public static final int ACTION_HOVER_MOVE
Synonym for MotionEvent#ACTION_HOVER_MOVE.

See Also:
Constant Field Values

ACTION_SCROLL

public static final int ACTION_SCROLL
Synonym for MotionEvent#ACTION_SCROLL.

See Also:
Constant Field Values

ACTION_POINTER_INDEX_MASK

public static final int ACTION_POINTER_INDEX_MASK
Synonym for MotionEvent#ACTION_POINTER_INDEX_MASK.

See Also:
Constant Field Values

ACTION_POINTER_INDEX_SHIFT

public static final int ACTION_POINTER_INDEX_SHIFT
Synonym for MotionEvent#ACTION_POINTER_INDEX_SHIFT.

See Also:
Constant Field Values

ACTION_HOVER_ENTER

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 android.view.View#onGenericMotionEvent(MotionEvent) rather than android.view.View#onTouchEvent(MotionEvent).

See Also:
Constant Field Values

ACTION_HOVER_EXIT

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 android.view.View#onGenericMotionEvent(MotionEvent) rather than android.view.View#onTouchEvent(MotionEvent).

See Also:
Constant Field Values
Constructor Detail

MotionEventCompat

public MotionEventCompat()
Method Detail

getActionMasked

public static int getActionMasked(MotionEvent event)
Call MotionEvent#getAction, returning only the ACTION_MASK portion.


getActionIndex

public static int getActionIndex(MotionEvent event)
Call MotionEvent#getAction, returning only the pointer index portion


findPointerIndex

public static int findPointerIndex(MotionEvent event,
                                   int pointerId)
Call MotionEvent#findPointerIndex(int). If running on a pre-android.os.Build.VERSION_CODES#ECLAIR device, does nothing and returns -1.


getPointerId

public static int getPointerId(MotionEvent event,
                               int pointerIndex)
Call MotionEvent#getPointerId(int). If running on a pre-android.os.Build.VERSION_CODES#ECLAIR device, IndexOutOfBoundsException is thrown.


getX

public static float getX(MotionEvent event,
                         int pointerIndex)
Call MotionEvent#getX(int). If running on a pre-android.os.Build.VERSION_CODES#ECLAIR device, IndexOutOfBoundsException is thrown.


getY

public static float getY(MotionEvent event,
                         int pointerIndex)
Call MotionEvent#getY(int). If running on a pre-android.os.Build.VERSION_CODES#ECLAIR device, IndexOutOfBoundsException is thrown.