Sunday, June 27, 2010

Showing Route through Google Map in Android

To show the route between two places in google map, we can use


this url.

Here I used the latitude and longitude of Chennai and Madurai, two cities in India.

The complete code snippet is,


public class LaunchMap extends MapActivity {

Uri uri;

public void onCreate(Bundle savedInstanceState) {
uri =Uri.parse(",80.17000&daddr=9.580000,78.100000");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);

protected boolean isRouteDisplayed() {
return false;

For showing this, we need to include the google map library in Manifest file.

A the time of launching , a pop up will ask to open in Browser or Google maps, just click on google map and it will show a list displaying the step by step direction as,

If we click on the list item it will show the map as,

No comments:

Post a Comment