get Distance using Location.distance Between method - Android java.lang

Android examples for java.lang:Math Trigonometric Function

Description

get Distance using Location.distance Between method

Demo Code


//package com.java2s;
import android.location.Location;

public class Main {

    public static double getDistance(double startLongitude,
            double startLatitude, double endLongitude, double endLatitude) {
        float[] results = new float[3];
        Location.distanceBetween(startLatitude, startLongitude,
                endLatitude, endLongitude, results);
        return results[0];
    }//from w w w  .  java 2  s.com
}

Related Tutorials