gpt4 book ai didi

java - Android - LocationManager 小数点后的数字

转载 作者:太空宇宙 更新时间:2023-11-04 13:07:55 25 4
gpt4 key购买 nike

我有一个简短的问题,当我从 LocationManager 获取位置时,获得的坐标没有任何精度:

    locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,2000,10, this);
@Override
public void onLocationChanged(Location location) {
String msg = "New Latitude: "+location.getLatitude()+"New Longitude: "+location.getLongitude();
Toast.makeText(getBaseContext(), msg, Toast.LENGTH_LONG).show();
}

结果是:

New Latitude: 19.0New Longitude: 51.0

如何设置我想要获取小数点后的位数?

最佳答案

我在 Android 设备监视器中输入了错误的坐标。当我输入 51.02 时,它会执行我所描述的操作,但是当输入 51,02 时,一切正常。抱歉给大家带来麻烦。

关于java - Android - LocationManager 小数点后的数字,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34251753/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com