0

I put an example in photo:

PhotoExample

So, I'll have a list of coordinates. These coordinates would be just the longitude and latitude of several places. So I would not want to go through JSON. But I do not know if it's possible to do it just by passing this data to "Google direction". If so, would you have an example?

Zoe
  • 27,060
  • 21
  • 118
  • 148
Jack
  • 33
  • 1
  • 5

1 Answers1

1

By using latitudes and longitudes you can add points(markers) but not path,below is the code for showing markers in Google maps.

private void addMarkers(List<Data> list) {

        for (int i = 0; i < list.size(); i++) {
            final Lat Lng position = new LatLng(list.get(i).getCurrent_lat(), list.get(i).getCurrent_lng());
            final MarkerOptions options = new MarkerOptions().position(position);

            mMaps.addMarker(options);

        }

    }

For the paths you have to use polyline.This is the link to draw polyline in googlemaps.

Naveen
  • 814
  • 2
  • 9
  • 22
  • Thanks. I will try. – Jack May 16 '18 at 14:20
  • With this method it is not possible to do some sort of navigation. That is to say that the person can add location (marker) as in the photo is browse according to its location. But , I think this method is just design it does not manage the navigation/course no? – Jack May 16 '18 at 14:48
  • Above method is to locate Markers not the Navigation(Polyline). – Naveen May 17 '18 at 05:25