FileDocCategorySizeDatePackage
MotionEventCompat.javaAPI DocAndroid 5.1 API8087Thu Mar 12 22:22:56 GMT 2015android.support.v4.view

MotionEventCompat

public class MotionEventCompat extends Object
Helper for accessing features in {@link MotionEvent} introduced after API level 4 in a backwards compatible fashion.

Fields Summary
static final MotionEventVersionImpl
IMPL
Select the correct implementation to use for the current platform.
public static final int
ACTION_MASK
Synonym for {@link MotionEvent#ACTION_MASK}.
public static final int
ACTION_POINTER_DOWN
Synonym for {@link MotionEvent#ACTION_POINTER_DOWN}.
public static final int
ACTION_POINTER_UP
Synonym for {@link MotionEvent#ACTION_POINTER_UP}.
public static final int
ACTION_HOVER_MOVE
Synonym for {@link MotionEvent#ACTION_HOVER_MOVE}.
public static final int
ACTION_SCROLL
Synonym for {@link MotionEvent#ACTION_SCROLL}.
public static final int
ACTION_POINTER_INDEX_MASK
Synonym for {@link MotionEvent#ACTION_POINTER_INDEX_MASK}.
public static final int
ACTION_POINTER_INDEX_SHIFT
Synonym for {@link MotionEvent#ACTION_POINTER_INDEX_SHIFT}.
public static final int
ACTION_HOVER_ENTER
Constant for {@link #getActionMasked}: 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 {@link android.view.View#onGenericMotionEvent(MotionEvent)} rather than {@link android.view.View#onTouchEvent(MotionEvent)}.

public static final int
ACTION_HOVER_EXIT
Constant for {@link #getActionMasked}: 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 {@link android.view.View#onGenericMotionEvent(MotionEvent)} rather than {@link android.view.View#onTouchEvent(MotionEvent)}.

Constructors Summary
Methods Summary
public static intfindPointerIndex(android.view.MotionEvent event, int pointerId)
Call {@link MotionEvent#findPointerIndex(int)}. If running on a pre-{@link android.os.Build.VERSION_CODES#ECLAIR} device, does nothing and returns -1.

        return IMPL.findPointerIndex(event, pointerId);
    
public static intgetActionIndex(android.view.MotionEvent event)
Call {@link MotionEvent#getAction}, returning only the pointer index portion

        return (event.getAction() & ACTION_POINTER_INDEX_MASK)
                >> ACTION_POINTER_INDEX_SHIFT;
    
public static intgetActionMasked(android.view.MotionEvent event)
Call {@link MotionEvent#getAction}, returning only the {@link #ACTION_MASK} portion.


                  
         
        return event.getAction() & ACTION_MASK;
    
public static intgetPointerCount(android.view.MotionEvent event)
The number of pointers of data contained in this event. Always >= 1.

        return IMPL.getPointerCount(event);
    
public static intgetPointerId(android.view.MotionEvent event, int pointerIndex)
Call {@link MotionEvent#getPointerId(int)}. If running on a pre-{@link android.os.Build.VERSION_CODES#ECLAIR} device, {@link IndexOutOfBoundsException} is thrown.

        return IMPL.getPointerId(event, pointerIndex);
    
public static floatgetX(android.view.MotionEvent event, int pointerIndex)
Call {@link MotionEvent#getX(int)}. If running on a pre-{@link android.os.Build.VERSION_CODES#ECLAIR} device, {@link IndexOutOfBoundsException} is thrown.

        return IMPL.getX(event, pointerIndex);
    
public static floatgetY(android.view.MotionEvent event, int pointerIndex)
Call {@link MotionEvent#getY(int)}. If running on a pre-{@link android.os.Build.VERSION_CODES#ECLAIR} device, {@link IndexOutOfBoundsException} is thrown.

        return IMPL.getY(event, pointerIndex);