java - 从 Eclipse 的模拟器控制返回不准确的值

标签 java android eclipse google-maps

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

这是我的主要类(class)的一部分。

我应该获取从模拟器发送的内容。但我得到的不是精确值,而是:

纬度 - 14.069315 经度 - 121.323738

但是我发送了这个(从我的模拟器控件) 纬度 - 14.069316 经度 - 121.323739

这只是一个十进制数和一个小值的问题,但我担心这是否会对我的应用程序上显示的内容产生很大影响,因为我将使用这些值在我的 Google map 上添加标记.

有什么建议吗?

最佳答案

这对我来说听起来像是舍入误差。

我不会担心这么多的错误,因为 number at the sixth decimal place equates to less than 1 meter on the ground (depending what latitude the location is at) .

关于java - 从 Eclipse 的模拟器控制返回不准确的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11404358/

相关文章:

python - 如何在eclipse中获取包图标?

java - 使用 SharedPreferences 的最安全方式

java - 在 Windows 7 上的 Eclipse Luna Release (4.4.0) 中克隆 GitHub 存储库

java - 从 Oracle 中的远程表插入本地表

android - 从游标适配器删除和更新值

java - 在 Eclipse 中的父项目之间移动 Maven 模块

java - 大括号在 Eclipse 中不起作用

java - 具有共同偏好的不当行为

java - Android 上的动画

java - 如何使用 Eclipse 构建 GUI? (我只想使用 swing/awt 而没有其他包)