我有两个经度和纬度值。即,
longitude1 和latitude1 来自网络服务
和longitude2 和latitude2 是我的设备值。
所以我想计算这两个地址之间的差异。所以我尝试了下面的代码
private Geocoder geocoder;
geocoder=new Geocoder(this);
Address address1=geocoder.getFromLocation(latitude1,longitude1,1).get(0);
Address address2=geocoder.getFromLocation(latitude2,longitude2,1).get(0);
所以我想知道地址 1 和地址 2 之间的区别。所以请告诉我如何找出address1、address2之间的区别。
提前致谢。
最好的问候
最佳答案
使用下面的方法
Location.distanceBetween (double startLatitude, double startLongitude, double endLatitude, double endLongitude, float[] 结果);
因此结果[0] 具有两个位置之间以米为单位的近似距离。
关于android - 如何获得两个gps地址之间的差异,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6426487/