2

I have a list of places in listview which i got from parsing JSON.
When user clicks in one of the listview, google maps open (Which i already done).
What I want is that when user clicks one of list items, Then google map opens with marking current position and user clicked place in list item, Then show direction between them, which i couldnot do.
I had googled alot but can not find the appropriate answer.
I'm newbie to google map, Please note me down clearly.
Help me Stackoverflow-ians !!!

2 Answers 2

1

Please check the below google map's webservice for fetching both the directions and also the route between then in the poly line points format.

http://maps.google.com/maps/api/directions/xml?origin=XXXXXX&destination=XXXXXX&sensor=false

Please replace the above Origin and Destination and parse it and use it

1

Easiest way would be to call the URL:

http://ditu.google.cn/maps?f=d&source=s_d&saddr=" + point1lat + ","+ point1long+ "&" + "daddr=" + point2lat+ "," + point2long+ "&hl=zh"

This opens GoogleMaps on android phones and shows you the route from point1 to point2.

1
  • 1
    @Pavandroid @MADMap : I am end up with using followin code: final Intent intent = new Intent(Intent.ACTION_VIEW,Uri.parse( "http://maps.google.com/maps?" + "saddr=lat1,longt1" + "&daddr=lat2,longt2")); intent.setClassName( "com.google.android.apps.maps", "com.google.android.maps.MapsActivity"); startActivity(intent);' Actually it opens google map going out of my app, How can i make it to open in my app ?? ` Commented Mar 31, 2012 at 16:14

Not the answer you're looking for? Browse other questions tagged or ask your own question.