簡體   English   中英

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();
}

結果是:

新緯度:19.0新經度:51.0

如何設置小數點后要獲取的位數?

我在Android設備監視器中輸入了錯誤的坐標。 當我輸入51.02時,它執行了我所描述的操作,但是當輸入51,02時,一切正常。 對不起,麻煩您了。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM