在这里,我想将每个json对象传递给另一个活动,并将该对象值设置为某个textview

时间:2017-06-29 03:56:18

标签: json

将vehiclename对象传递给另一个活动

并将该值设置为文本视图

请帮帮我

JsonObjectRequest req = new JsonObjectRequest(Request.Method.GET, url, null,
            new Response.Listener<JSONObject>() {
                public void onResponse(JSONObject response) {
                    try {
                        JSONObject object1 = response.getJSONObject("liveMapResponseVO");
                        JSONArray jsonArray = object1.getJSONArray("locations");
                        for(int i=0; i<jsonArray.length(); i++){
                            JSONObject jsonObject = (JSONObject) jsonArray.get(i);
                            Movie movie = new Movie();
                            movie.setTitle(jsonObject.getString("vehicleName"));
                            movie.setRating(jsonObject.getString("speed"));
                            movie.setGenre(jsonObject.getString("stopTime"));
                            movie.setYear(jsonObject.getString("idleTime"));
                            Log.d(TAG, jsonObject.getString("vehicleName"));
                            movieList.add(movie);
                        }
                        pDialog.hide();
                    } catch (JSONException e) {
                        e.printStackTrace();
                    }
                    adapter.notifyDataSetChanged();
                }

0 个答案:

没有答案