如何使用Java代码在折线上添加信息

时间:2018-09-17 02:27:38

标签: google-app-engine

public void onResponse(Call<String> call, Response<String> response) {
    try{
        JSONObject jsonObject = new JSONObject(response.body().toString());
        JSONArray jsonArray = jsonObject.getJSONArray("routes");

        for (int i=0;i<jsonArray.length(); i++) {

            JSONObject route = jsonArray.getJSONObject(i);

            JSONObject poly = route.getJSONObject("overview_polyline");

            String polyline = poly.getString("points");
            polylineList = decodePoly(polyline);
        }

        //Adjusting bounds 

        LatLngBounds.Builder builder = new LatLngBounds.Builder();
        for(LatLng latlng:polylineList)
            builder.include(latlng);

        LatLngBounds bounds= builder.build();

        PolylineOptions polylineOptions = new PolylineOptions();
        polylineOptions.color(Color.BLUE);
        polylineOptions.width(5);
        polylineOptions.startCap(new SquareCap());
        polylineOptions.endCap(new SquareCap());
        polylineOptions.jointType(JointType.ROUND);
        polylineOptions.addAll(polylineList);
        bluePolyline=mMap.addPolyline(polylineOptions);

我的代码正确,折线没问题,但是我在网址上使用mode = transit,所以我想在折线中添加这些的short_name(它是Google用来查看公交车号码存储位置的代码名称)过境。谁能帮我?我对应用程序编码真的很陌生,实际上这是我第一次

0 个答案:

没有答案