Here you can find the source of getDistance(double lat1, double lon1, double lat2, double lon2)
public static double getDistance(double lat1, double lon1, double lat2, double lon2)
//package com.java2s; import android.location.Location; public class Main { public static double getDistance(double lat1, double lon1, double lat2, double lon2) { float[] results = new float[1]; Location.distanceBetween(lat1, lon1, lat2, lon2, results); return results[0]; }/*w ww. j a v a2 s. c o m*/ }