0

I want to take to string as input example New Delhi & Mumbai and i want to show the path between them on Google map.

i have used this but it was not working.

String new_url = "http://maps.google.com/maps?saddr=" + ServerData.LATTITUDE + "," + ServerData.LONGITUDE + "&daddr=" + latitude + "," + longitude ;

Intent intent_map = new Intent(Intent.ACTION_VIEW, Uri.parse(new_url));
startActivity(intent_map);
Kara
  • 6,115
  • 16
  • 50
  • 57

2 Answers2

0

This link have tutorial to draw route path on map in our app. this may help you and use below to link with map app... this will take to you in google map application

String uri = "http://maps.google.com/maps?f=d&hl=en&saddr="+source_latitude+","+source_longitude+"&daddr="+destination_latitude+","+destination_longitude;
Intent intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(uri));
intent.setClassName("com.google.android.apps.maps", "com.google.android.maps.MapsActivity");
startActivity(intent);

OR

refter this link how to display the driving routes

Community
  • 1
  • 1
Sanket Kachhela
  • 10,861
  • 8
  • 50
  • 75
0

Before startActivty(intent_map); try to add

intent_map.setClassName("com.google.android.apps.maps","com.google.android.maps.MapsActivity").addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);

Kartheek Sarabu
  • 3,886
  • 8
  • 33
  • 66