Distance calculation from my location to destination location in android

android, distance, location

Solution

check the documentation on the google android dev page to see how to listen for position changes. http://developer.android.com/guide/topics/location/obtaining-user-location.html

you can use this function to determine the distance between the current (start) point and the target point.

 /**
 * using WSG84
 * using the Metric system
 */
public static float getDistance(double startLati, double startLongi, double goalLati, double goalLongi){
    float[] resultArray = new float[99];
    Location.distanceBetween(startLati, startLongi, goalLati, goalLongi, resultArray);
    return resultArray[0];
}

Problem

I have to made a project where i need to calculate the distance from my location to destination location and show it in a textview.Here note that this distance updated when my location change.Is it possible to make such type of project ? [NOTE: without implementing Google map i have to make it.The destination lon ,lat is known.Just have to find my location and make the calculation]

Original source

Related problems