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]
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];
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With