0

How Can I draw a dynamic route or path on Google maps in android ?

Can anyone give me an example ? How to draw my GPS location on map in real-time ?

Sachin Prasad
  • 5,365
  • 12
  • 54
  • 101
Amr Ahmed
  • 71
  • 1
  • 12
  • try this http://mirnauman.wordpress.com/2012/04/26/android-google-maps-tutorial-part-7-drawing-a-path-or-line-between-two-locations/ – Deepak Swami Dec 27 '12 at 10:26
  • thanks, I read it before but what i want is to draw a dynamic path not static ... and this path must go through roads ... How can i do this .... is there away or not ? – Amr Ahmed Dec 27 '12 at 10:31
  • [http://stackoverflow.com/questions/14050789/joining-markers-to-draw-path-in-android-google-map/14051162#comment19416827_14051162][1] [1]: http://stackoverflow.com/questions/14050789/joining-markers-to-draw-path-in-android-google-map/14051162#comment19416827_14051162 – Dhana Dec 27 '12 at 10:42
  • @AmrAhmed then try http://stackoverflow.com/a/2663565/1023248 – Deepak Swami Dec 27 '12 at 11:30

1 Answers1

0

Just use the V2 of the API that it's as simple as using a for loop

PolylineOptions p = new PolylineOptions().width(3).color(0xFFEE8888);
for (int i = 0; i < data.length; i++) {
    p.add(new LatLng(lat, lng));
}
mMap.addPolyline(p);
Budius
  • 39,391
  • 16
  • 102
  • 144