compute Distance for MotionEvent - Android User Interface

Android examples for User Interface:MotionEvent

Description

compute Distance for MotionEvent

Demo Code


import android.util.MathUtils;
import android.view.MotionEvent;

public class Main{
    public static double computeDistance(MotionEvent first,
            MotionEvent second, int pointerIndex) {
        return MathUtils.dist(first.getX(pointerIndex),
                first.getY(pointerIndex), second.getX(pointerIndex),
                second.getY(pointerIndex));
    }//www  .  j a va  2  s.c om
}

Related Tutorials