小编use*_*541的帖子

使用经度和纬度比较两个位置

嗨我需要在onchangelocation()上调用一个事件,通过比较当前纬度和经度与一些保存的纬度和经度,但我得到一个错误.日食不识别关键词距离,并且对于校正错误它给出提示箱子方法"距离"有4参数...如何解决它?或其他一些方式做同样的工作???

感谢致敬.代码附在下面

@Override
public void onLocationChanged(Location location) {
 double currentLat=location.getLatitude();
 double currentLon=location.getLongitude();

    if (distance(lat,lon,currentLat,currentLon)<2.0){
 //do what you want to do...
  }
}
Run Code Online (Sandbox Code Playgroud)

android android-location android-mapview

15
推荐指数
2
解决办法
2万
查看次数