我正在尝试将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); 
    }
});

有人知道代码吗?

谢谢

===============>>#1 票数:0 已采纳

要启动将您带到单个GPS位置的Intent ,请使用:

   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);

  ask by Shams translate from so

未解决问题?本站智能推荐: