how can i get the distance between two points and show that distance in Google map? please help me. i have tried to get direction between two points but i am not able to get the distance between them.. my code is:
private String getMapsApiDirectionsUrl() {
String origin = "origin=" + mCurrentLocation.getLatitude() + "," + mCurrentLocation.getLongitude();
String destination = "destination=" + mDestLocation.latitude + "," + mDestLocation.longitude;
/*String origin = mCurrentLocation.getLatitude() + "," + mCurrentLocation.getLongitude();
String destination =mDestLocation.latitude + "," + mDestLocation.longitude;*/
String waypoints = "waypoints=optimize:true|"
+ mCurrentLocation.getLatitude() + "," + mCurrentLocation.getLongitude()
+ "|" + "|" + mDestLocation.latitude + ","
+ mDestLocation.longitude;
String sensor = "sensor=false";
String params = origin + "&" + destination + "&" + waypoints + "&" + sensor;
String output = "json";
String url = "https://maps.googleapis.com/maps/api/directions/"
+ output + "?" + params;
return url;
}