我如何才能获得alertdialog中的当前位置?

时间:2012-02-27 12:21:42

标签: android android-alertdialog

如何获取我在AlertDialog中的当前位置

String text = String.format("Lat:\t %f\nLong:\t %f\nAlt:\t %f\nBearing:\t %f", location.getLatitude(), location.getLongitude(), location.getAltitude(), location.getBearing());
this.locationText.setText(text);

请求帮助

1 个答案:

答案 0 :(得分:1)

Google在此主题上提供了大量documentation

要记住的重要一点是,如果用户使用GPS,获取用户当前位置可能需要很长时间。您可以采用多种方法,但是如果要快速显示包含位置信息的对话框,则应使用“getLastKnownLocation”,它可能不准确,但速度很快。

相关问题