如何使用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