user6032761 user6032761 - 4 months ago 16
Android Question

Android: Draw direction in google map java

how to find the best route for multiple locations in google maps api in android? I have some locations as LatLng but I dont know how specify a optimal route

Answer
ArrayList<LatLng> directionPoint = latLongList;
            PolylineOptions rectLine = new PolylineOptions().width(8).color(
                    Color.RED);

            for (int i = 0; i < directionPoint.size(); i++) {
                rectLine.add(directionPoint.get(i));
            }

            // Adding route on the map
            map.addPolyline(rectLine);

Try this , pass your list of latlongs in latLongList

Comments