Code example for MotionEvent

Methods: getPointerCountgetXgetY

0
        dragLastY = dragCurrentY;
    } 
 
    /** Calculates the distance between the 2 current pointers */ 
    private float distance(MotionEvent event) {
        if (event.getPointerCount() < 2) {
            return 0; 
        } 
        return PointF.length(event.getX(POINTER1) - event.getX(POINTER2), //
                event.getY(POINTER1) - event.getY(POINTER2));
    } 
 
    /** 
     * Test if a MotionEvent with the given start and end offsets 
     * can be considered as a "click". 
     * @param upEvent The final finger-up event. 
     * @param xDown   The x-offset of the down event. 
     * @param yDown   The y-offset of the down event. 
     * @param xUp     The x-offset of the up event. 
     * @param yUp     The y-offset of the up event. 
     * @return true if it's a click, false otherwise