I have a program in which latitude and longitude values of a location are stored in a database, which I download.
I want to get the distance between these coordinates, and my current location.
The Location class has a simple method to find the distance between two Location objects, so I figured I'd make a Location object with the coordinates, then call the method.
Is there an easy way to do this? Also, if there's another reliable, fairly simple equation that won't clutter things too much, that would work too. Thanks.
(android.location.Location)
I am answering this again, because lot of people like me do not know what
"providername"
actually is. Below code answers the question:Here I am using
"LocationManager.GPS_PROVIDER"
has provider.Assuming that you already have a location object with you current location.
You may create locations using their constructor, then set the latutude and longitude values.