In Android Studio, I just can\'t find the errors to this problem, I have the fol
ID: 3675420 • Letter: I
Question
In Android Studio, I just can't find the errors to this problem, I have the following code written down, what I need is just how to make a direct route/directions between 2 specific coordinates, specifically I need the coordinates (34.782, -86.569) to have a direct route to (34.781, -86.571) thank you
Here is Code:
PolylineOptions lineOptions = new PolylineOptions();
//create lat lng object
LatLng ll1 = new LatLng(34.782, -86.569);
LatLng ll2 = new LatLng(34.781, -86.571);
//add both lat lng to line options
lineOptions.addAll(new ArrayList<LatLng>(){ll1,ll2});
mMap.addPolyline(lineOptions); //add line to map
Explanation / Answer
Create ArrayList of LatLng objects separately and add LatLng objects to the ArrayList individually. Once ArrayList is populated, then pass it to PolylineOptions object.