private void showDistance() { double distance = SphericalUtil.computeDistanceBetween(mMarkerA.getPosition(), mMarkerB.getPosition()); mTextView.setText("The markers are " + formatNumber(distance) + " apart."); }
/** * Get the latitude distance in the middle longitude * * @param minLatitude * @param maxLatitude * @return */ public static double getLatitudeDistance(double minLatitude, double maxLatitude) { LatLng lowerMiddle = new LatLng(minLatitude, 0); LatLng upperMiddle = new LatLng(maxLatitude, 0); double latDistance = SphericalUtil.computeDistanceBetween(lowerMiddle, upperMiddle); return latDistance; }