我正在尝试将GPS从2个位置更改为1个位置
2个地点的代码是:
ismi.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
String CURRENT_LOCATION = "37.967775, 23.720689";
String DESTINATION_LOCATION = "37.925942, 23.938683";
Intent intent = new Intent(android.content.Intent.ACTION_VIEW,
Uri.parse("http://maps.google.com/maps?saddr="+ CURRENT_LOCATION +"&daddr="+DESTINATION_LOCATION)); //Added ampersand
startActivity(intent);
}
});
并更改为以下位置:http://i.stack.imgur.com/zCvW5.png
我甚至改变了一部分,但它从我的位置到目的地
代码:
ismi.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
String DESTINATION_LOCATION = "37.925942, 23.938683";
Intent intent = new Intent(android.content.Intent.ACTION_VIEW,
Uri.parse("http://maps.google.com/maps?saddr=" +"&daddr="+DESTINATION_LOCATION)); //Added ampersand
startActivity(intent);
}
});
有人知道这些代码吗?
由于
答案 0 :(得分:0)
要启动将Intent
带到单个GPS位置的 String DESTINATION_LOCATION = "37.925942,23.938683";
Intent intent = new Intent(android.content.Intent.ACTION_VIEW,
Uri.parse("http://maps.google.com/maps?q="+DESTINATION_LOCATION));
startActivity(intent);
,请使用:
URI
GPS
包含您之前定义的DESTINATION_LOCATION
坐标。请注意,String
String DESTINATION_LOCATION = "My location name";
String latit = "37.925942";
String longit = "23.938683";
Intent intent = new Intent(android.content.Intent.ACTION_VIEW,
Uri.parse("geo:<"+latit+">,<"+longit+">?q=<"+latit+">,<"+longit+">("+DESTINATION_LOCATION+")")); //name the label
startActivity(intent);
中的纬度和经度值之间不应有空格。
编辑:作为对评论中第一个问题的回复,为标签命名:
{{1}}