如何使用Google Maps intent以编程方式在android google maps中添加停靠点或航点 [英] How to add Stops or Waypoints in android google maps programmatically using Maps intent

查看:77
本文介绍了如何使用Google Maps intent以编程方式在android google maps中添加停靠点或航点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是我用来显示Google地图的代码,包含来源&目的地地址,但在这一点上,我需要添加停靠点或方式点。如何添加。

Below is the code i am using to show google map with source & destination address, But in that i need to add Stops or way points. How can I add.

String uri = "http://maps.google.com/maps?saddr=" + String.valueOf(currentLat) + "," + String.valueOf(currentLng) + "&daddr=" + String.valueOf(latitude) + "," + String.valueOf(longitude);
Intent intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(uri));
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setClassName("com.google.android.apps.maps", "com.google.android.maps.MapsActivity");
if (intent.resolveActivity(getActivity().getPackageManager()) != null) {
    startActivity(intent);
}


推荐答案

得到了答案。检查下面的代码

Got the answer. Check code below

final String uri = "http://maps.google.com/maps?daddr=Gachibowli"+"+to:Lingampally+to:Nizampet+to:kukatpally+to:moosapet+to:Nizampet+to:srnagar+to:ameerpet+to:jubileehills+to:kothaguda";
final Intent intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(uri));
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setClassName("com.google.android.apps.maps", "com.google.android.maps.MapsActivity");
if (intent.resolveActivity(getActivity().getPackageManager()) != null) {
    startActivity(intent);
}

+ to:will add stops

"+to:" will add stops

这篇关于如何使用Google Maps intent以编程方式在android google maps中添加停靠点或航点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆