Android : Location.distanceTo not working correctly?

前端 未结 1 1877
太阳男子
太阳男子 2021-01-02 00:55

I am having an issue calculating distance using the Location.distanceTo method.

private class MyLocationOverlay1 extends MyLocationOverlay {
            


        
相关标签:
1条回答
  • 2021-01-02 01:17

    You should Modify lines:

    aLocation.setLatitude(myLocation.getLatitudeE6() / 1e6);
    aLocation.setLongitude(myLocation.getLongitudeE6() / 1e6);
    

    And remove the lines:

    aLocation.set(aLocation);
    bLocation.set(bLocation);
    
    0 讨论(0)
提交回复
热议问题