1
下面的方法一直返回0,我找不到原因!請幫忙!當它不應該返回0時
currentLocation.setLatitude(38.03211);
currentLocation.setLongitude(-78.51002);
和經度/如果LOC的緯度 38.03161, -78.51075,
public double getDistance(HistoricalLocation loc) {
return (double) Math.abs(Math.sqrt((currentLocation.getLatitude() - loc
.getLatitude())
* (currentLocation.getLatitude() - loc.getLatitude())
+ (currentLocation.getLongitude() - loc.getLongitude())
* (currentLocation.getLongitude() - loc.getLongitude())));
}
發佈您的logcat的詳細信息。 – 2013-04-20 03:36:47
你在設備上測試它嗎? – 2013-04-20 03:37:39
'loc'的值是什麼?你只顯示'currentLocation'的值。 – FoamyGuy 2013-04-20 03:37:44