【发布时间】:2018-10-31 07:28:54
【问题描述】:
我正在 android 中创建一个 hicking 应用程序,到目前为止,我可以在我想要创建的过程中插入各种标记的路径,现在我想在从我的 mysql 数据库获得的标记之间绘制一条折线. 希望能提供一些关于我可以在标记之间画线的最佳方法的指南。
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();
}
基本上我在单击按钮时获得标记,我想知道如何添加线条。
提前感谢您的帮助
【问题讨论】:
标签: android json maps android-volley polyline