Android - LocationManager 小数点后的数字

Android - LocationManager digits after decimal

我有一个简短的问题,当我从 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 时,一切正常。麻烦大家了。