//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
但我发送了这个(从我的模拟器控件(纬度 - 14.069316经度 - 121.323739
这只是一个十进制数和一个小值的问题,但我担心这是否会对我的应用程序上出现的内容产生重大影响,因为我将使用这些值在我的 Google 地图上添加标记。
有什么建议吗?
这
对我来说听起来像是舍入误差。
我不会担心这种误差,因为小数点后第六位的数字相当于地面不到 1 米(取决于位置所在的纬度(。