Android examples for android.location:Distance
Calculate distance between two PointF
import android.graphics.PointF; public class Main{ public static float dist(PointF p1, PointF p2) { float dist = (float) Math.sqrt(Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2)); return dist; }//ww w. j a v a2s . com }