Android distancebetween: really strange behavior

Something really strange is going on there.

My application calculates the distance between two points stored in a text file:

Location.distanceBetween(lat1, long1, lat2, long2, res);

      

What I get when I log the following:

Log.d(tag, "lat1: " + lat1 + ", long1: " + long1 + ", lat2: " + lat2 + ", long2: " + long2 + ", dist: " + res[0]);

      

Output on sony smartphone:

lat1: 49.358788, long1: 7.25395, lat2: 49.358771, long2: 7.254031, dist: 6.180519

      

Output to lenovo tablet:

lat1: 49.358788, long1: 7.25395, lat2: 49.358771, long2: 7.254031, dist: 110.74074

      

As you can see, the distance is very different. But why???

The timer works by calculating the distance between two points every second. Most of the calculations are fine, but some of them are completely wrong.

+3


source to share





All Articles