Measure Distance Walked With Geopoint And Displaying Distance To User
Solution 1:
One problem in your code is when you create a GeoPoint
from a Location
in onLocationChanged(Location location)
. Both getLatitude()
and getLongitude()
from the class Location
return degrees, but the constructor for GeoPoint
takes microdegrees. This might be screwing up your distance calculation because your GeoPoint
coordinates could be, let's just say, 42 degrees, which turns out to be .0000042 degrees in the GeoPoint
.
Also, you might try printing the current location somehow, through the debug monitor or through a Toast
message. This will greatly help in the debugging process, as you can see your Lat/Long changing and debug from there.
Note: I would recommend updating to Maps v2, they changed a lot of classes and added LatLng
which makes things easier to understand :)
Post a Comment for "Measure Distance Walked With Geopoint And Displaying Distance To User"