【发布时间】:2012-04-20 12:18:37
【问题描述】:
我使用以下方法获取当前的经纬度:
locationManager = (LocationManager) getSystemService(LOCATION_SERVICE);
if (locationManager == null) {
Toast.makeText(LocationsListActivity.this,
"Location Manager Not Available", Toast.LENGTH_SHORT)
.show();
}
location = locationManager
.getLastKnownLocation(LocationManager.GPS_PROVIDER);
if (location == null)
location = locationManager
.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
if (location != null) {
double lat = location.getLatitude();
double lng = location.getLongitude();
但问题是我得到的 lat 和 lng 小数点后只有 8 个数字(lat: 52.51491445, lng: 13.39044515) 我想要的是我得到的 lat 和 lng 在小数点后有 13 个数字。
我该怎么做? 谢谢
【问题讨论】:
-
你确定 lat 只有 8 位小数吗?或者它只是这个值的字符串表示......
-
en.wikipedia.org/wiki/Floating_point ... 你看到的只是一个字符串 ... 也许 Double.toString() 让它看起来只有 8 位小数
-
这样可以得到多于12位小数的经纬度吗?
标签: android google-maps gps