I'm creating a hicking app in android, and so far, i can insert my path inserting various markers along the way i want to create, now i want to draw a polyline between the markers that i get from my mysql database. Would appreciate some guide to the best way i can draw the lines between my markers.
public void getCoordsId(final String id_trilho) {
RequestQueue requestQueue = Volley.newRequestQueue(MapsActivity.this);
StringRequest stringRequest = new StringRequest(Request.Method.POST, urlget,
new Response.Listener<String>() {
LatLng location;
@Override
public void onResponse(String response) {
System.out.println(response);
Toast.makeText(MapsActivity.this, "boa entrou", Toast.LENGTH_LONG).show();
try {
JSONArray array = new JSONArray(response);
for (int i = 0; i < array.length(); i++) {
JSONObject jo = array.getJSONObject(i);
Double lat = Double.parseDouble(jo.getString("lat"));
Double lng = Double.parseDouble(jo.getString("lon"));
location = new LatLng(lat,lng);
MarkerOptions options = new MarkerOptions();
options.position(location);
mMap.addMarker(options);
}
} catch (JSONException e) {
e.printStackTrace();
}
Basically i get the markers on a button click, i would like to know how i can add the lines.
Thank you for any help in advance