31

Possible Duplicate:
J2ME/Android/BlackBerry - driving directions, route between two locations

I'm just writing an App for displaying the route between two coords (lat, long) in google maps view. Displaying an single coord (even with a marker) works fine, but how to draw route between two point with 2 markers?

I must admit that I'm quite new to Android and the maps-API...

1
  • I am doing a similar kind of app and like to know if using kml or using the api to return a json is better.
    – O__O
    Commented Jun 10, 2012 at 2:03

2 Answers 2

27

this is working example link. check it out. it helps to create the route overlay on the map. here is the complete source code for that.

4
  • One note, you might be running afoul of the Google Maps api if you use it to obtain driving directions (they removed this capability from the android maps api).
    – Robby Pond
    Commented Apr 15, 2010 at 12:49
  • yep. but we can do manipulations with the kml file of maps. in my answer, they are retriving the coordinates points to the route from the google maps kml file. check the RoadProvider.java the are build the url to get the road coordintes from the kml file.
    – Praveen
    Commented Apr 15, 2010 at 13:02
  • Thank you, that's excactly the thing I was looking for :) I think this will help for understanding and re-program it by myself. Thanks again :)
    – poeschlorn
    Commented Apr 16, 2010 at 7:20
  • @praveen i have completely followed your above link for route map but i got null null pointer exception mpointsize .also am getting fatal exception as well here i have posted all my source code stackoverflow.com/questions/11928933/… please anyone help me out of this error am getting fatal and null pointer exception at drawpath() .and send me rectified code thanks in advance. Commented Aug 13, 2012 at 6:09
6

Your route will be a list of points so you have to create a route overlay class. And in the draw method of the overlay class you have to draw a Path between the points.

1
  • so true when it comes to offline maps too... Commented Apr 21, 2015 at 21:09

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