我正在尝试从intent打开地图。我想在此设置标记文本。有人帮助我 我的代码在下面给出
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
String latitude = latiTV.getText().toString();
String longitude = longiTV.getText().toString();
String label = addressTV.getText().toString();
String uriBegin = "geo:" + latitude + "," + longitude;
String query = latitude + "," + longitude + "(" + label + ")";
String encodedQuery = Uri.encode(query);
String uriString = uriBegin + "?q=" + encodedQuery + "&z=10";
System.out.println(uriString);
Uri uri = Uri.parse(uriString);
Intent intent = new Intent(android.content.Intent.ACTION_VIEW, uri);
startActivity(intent);
}
答案 0 :(得分:0)
要从Intent打开Google地图,您可以尝试:
String uri = String.format(Locale.ENGLISH, "geo:%f,%f", 27.175015, 78.042155);
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
startActivity(intent);
有关详细信息,请参阅此 link