簡體   English   中英

從Emulator Control of Eclipse返回的值不准確

[英]Inaccurate values returning from Emulator Control of Eclipse

            //Show the current coordinates (Convert to String and round off - 6 decimal places)
        String printLat = new DecimalFormat("0.######").format((double)currentLat);
        String printLon = new DecimalFormat("0.######").format((double)currentLon);

        AlertDialog alert = new AlertDialog.Builder(Main.this).create();
        alert.setTitle("Current Location:");
        alert.setMessage("Latitude: " + printLat+ "\n" + "Longitude: " + printLon);
        alert.setButton("Close", new DialogInterface.OnClickListener()
        {               
            public void onClick(DialogInterface arg0, int arg1)
            {
                // TODO Auto-generated method stub
                //Alert Dialog won't work without a listener
                //Do nothing (This will simply close your alert dialog)
            }
        });     
        alert.show();

這是我主要課程的一部分。

我應該從我的模擬器中獲取我發送的內容。 但我沒有檢索確切的值,而是得到了這個:

緯度 - 14.069315經度 - 121.323738

但我發送了這個(來自我的模擬器控制)Latitude - 14.069316經度 - 121.323739

這只是一個十進制數字和一個小值的問題,但我擔心這是否會對我的應用程序中顯示的內容產生很大影響,因為我將使用這些值在我的Google地圖上添加標記。

有什么建議么?

這聽起來像是我的舍入錯誤。

我不擔心這個誤差量,因為小數點后六位的數字相當於地面上不到1米(取決於該位置的緯度)

暫無
暫無

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

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