Divakar Joshi
Divakar Joshi

Reputation: 62

How can i draw my own route in google map android

This is the code i have done to implement.I need to implement an application, where i need to add my own route in google map. I have tried it with direction API but it draw like this.Image which draw route like this.

I only need to draw a single poly line on road on my way. So please suggest me a better way that how can i implement it.

Upvotes: 0

Views: 653

Answers (1)

tymbark
tymbark

Reputation: 1369

try this code:

public void addPolylineToMap(GoogleMap map, List<LatLng> route) {
    final PolylineOptions polyline = new PolylineOptions();

    for (LatLng point : route) {
        polyline.add(point);
    }

    polyline.width(5)
            .color(Color.RED);

    map.addPolyline(polyline);
}

Upvotes: 1

Related Questions