Search code examples
androidandroid-fragmentsgoogle-maps-api-2

How to draw path from current location to user entered location on map fragment?


I'm curious if there is a way to draw the path from a devices current location to a user entered location.From researching the only methods I have come across are to get path from lat and long coordinates like this solution http://blog-emildesign.rhcloud.com/?p=822 ,

My question is if there is a way to combine a users geo location and a user entered destination string to draw the path.I'm guessing this would involve reverse geo coding or am I wrong?

The current interface looks like this and I'm using Google maps API v2:

enter image description here


Solution

  • Look here for how to do a polyline in android map api v2 https://developers.google.com/maps/documentation/android/reference/com/google/android/gms/maps/model/Polyline

    Tip save your line as a kml file for interoperability so other apps will be able to import the file and show the same line on a map.