I have managed to trace the routes on the map, what I want to achieve is that the union between the polylines is rounded, or that there are no sharp cuts between strokes.
Stroke to which you wish to arrive:
public void onDrawRoutes(final GoogleMap mMap) throws JSONException {
final JSONArray polyline = mArray.getJSONObject(mRoute).getJSONArray("legs").getJSONObject(0).getJSONArray("steps");
new AsyncTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... params) {
for (int i = 0; i < polyline.length(); i ++) {
String points = null;
try {
points = polyline.getJSONObject(i).getJSONObject("polyline").getString("points");
} catch (JSONException e) {
e.printStackTrace();
}
lists.add(i, PolyUtil.decode(points));
}
return null;
}
@RequiresApi(api = Build.VERSION_CODES.M)
@Override
protected void onPostExecute(Void aVoid) {
for (int j = 0; j < lists.size(); j++) {
List<LatLng> iterable = lists.get(j);
mMap.addPolyline(new PolylineOptions()
.addAll(iterable)
.width(20)
.color(mContext.getResources().getColor(R.color.ligthBlue, null)).geodesic(true));
}
}
}.execute();
}