i just tried to calculate the Distance in meters between two static Points with the Location.distanceTo - Method.
The Problem is that the returned values are way too high - i expected the distance in meters but i get someting which is way higher.
Maybe its because of the setTime where i set the UTC-Time to the actual time (because i didnt knew what to do
).
Do you know whats wrong with my source?
Using java Syntax Highlighting
- public String distanceBetween(Point b){
- String distance = "";
- Location l = new Location();
- l.setLatitude(myLocation.getLatitudeE6());
- l.setLongitude(myLocation.getLongitudeE6());
- l.setTime(System.currentTimeMillis());
- Location l2 = new Location();
- l2.setLatitude(b.getLatitudeE6());
- l2.setLongitude(b.getLongitudeE6());
- l2.setTime(System.currentTimeMillis());
- distance = Float.toString( (l.distanceTo(l2) / 1000 ) ) ;
- return distance;
- }
Parsed in 0.033 seconds, using GeSHi 1.0.8.4
Im thankful for any clue






