geolocation - get distance between Current location and Selected Place in android -
i new android developing, want make application give me distance on mapview between current location , selected place.
please give me suggestion this.
get distance between current location , selected place using android.
public static double distfrom( double lat1, double lng1, double lat2, double lng2) { double earthradius = 3958.75; double dlat = math.toradians(lat2-lat1); double dlng = math.toradians(lng2-lng1); double = math.sin(dlat/2) * math.sin(dlat/2) + math.cos(math.toradians(lat1)) * math.cos(math.toradians(lat2)) * math.sin(dlng/2) * math.sin(dlng/2); double c = 2 * math.atan2(math.sqrt(a), math.sqrt(1-a)); double dist = earthradius * c; return dist; }
Comments
Post a Comment