计算在机器人2的纬度和经度点之间的距离

问题描述:

有关的纬度和放大器之一;经度点我有它的数据库和放大器;另外一个我想使用手机的当前位置

For one of the latitude & longitude points i have it in database & another one i want to use current position of the mobile

哪一个,我应该要用到它们之间如下:

  • 在Android的位置提供
  • 在谷歌API
  • 在数学计算

注意 ::任何演示code样品将是有益的。

note:: Any demo code sample will be useful

或内置algorythm:

or the built in algorythm:

Location locationA = new Location("point A");     
locationA.setLatitude(latA); 
locationA.setLongitude(lngA);
Location locationB = new Location("point B");
locationB.setLatitude(latB); 
LocationB.setLongitude(lngB);
distance = locationA.distanceTo(locationB) ;