Android Distance Calculate distanceInMeters(float distance)

Here you can find the source of distanceInMeters(float distance)

Description

distance In Meters

Declaration

public static String distanceInMeters(float distance) 

Method Source Code

//package com.java2s;

public class Main {
    public static String distanceInMeters(float distance) {
        String distanceStr = "";
        if (distance > 0) {
            if (distance >= 1000) {
                distanceStr = " "
                        + Float.toString(distance / 1000).replace(".", ",")
                        + " km";
            } else {
                if (distance % 1 == 0) {
                    distanceStr = " " + (int) distance + " m";
                } else {
                    distanceStr = " "
                            + Float.toString(distance).replace(".", ",")
                            + " m";
                }/*from  w w  w .  jav  a2 s. c o m*/
            }
        }
        return distanceStr;
    }
}

Related

  1. getDistance(double lat1, double lon1, double lat2, double lon2)
  2. dist(PointF p1, PointF p2)
  3. distance(int q1, int r1, int q2, int r2)
  4. distanceBetweenTwoLatLongs(Location oldLocation, Location newLocation)
  5. distanceBetweenTwoPoints(double lat1, double lng1, double lat2, double lng2)
  6. KmToMiles(int distance)
  7. getTempsTrajetBus(int distance)
  8. getTempsTrajetPied(int distance)