我怎样才能把一个名称的位置
问题描述:
我有这个代码来显示我的位置到另一个位置,但它不是问题,我怎么能为它添加一个名称?我怎样才能把一个名称的位置
locationname.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
String DESTINATION_LOCATION = "37.967775, 23.720689";
Intent intent = new Intent(android.content.Intent.ACTION_VIEW,
Uri.parse("http://maps.google.com/maps?saddr="
+ "&daddr=" + DESTINATION_LOCATION));
startActivity(intent);
}
});
我有这样的:
String DESTINATION_LOCATION = "My location name";
但它不适合在代码中! 有人知道吗?
感谢
答
这将默认地图打开和使用名称
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("geo:<lat>,<long>?q=<lat>,<long>(Label+Name)"));
startActivity(intent);
选项2
String urlAddress = "http://maps.google.com/maps?q="+ myLatitude +"," + myLongitude +"("+ labelLocation + ")&iwloc=A&hl=es";
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(urlAddress);
startActivity(intent);
添加标记,但,我不知道放在哪里了“名”那个地点! – Zahrana 2014-09-23 11:47:31
labelLocation本身就是您的位置名称 – 2014-09-23 11:49:05
谢谢:) ..“标签+名称”..标签是否意味着标记? – Zahrana 2014-09-23 11:51:29