我正在使用它来获取当前位置与用户选择的标记之间的距离:
float[] distance = new float[1];
Location currentLocation = PECApplication.getInstance().getLocationClient().getLastLocation();
Location.distanceBetween(currentLocation.getLatitude(), currentLocation.getLongitude(), marker.getPosition().latitude, marker.getPosition().longitude, distance);
但我无法将它解析为有理数,例如“30345”米,它一直返回“F@403202”之类的内容。所以我想知道如何将这种表示转换为小数..
谢谢你的帮助
最佳答案
参见方法文档distanceBetween .
distance
是一个array float 来保存结果。您可能正在打印数组,因此您正在打印数组的地址。
关于java - 如何解析 Location.distanceBetween 方法的结果?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17116295/