首页 > 编程语言 > 详细

Volley获取json数组

时间:2015-08-13 11:41:03      阅读:267      评论:0      收藏:0      [点我收藏+]

private void getJSONByVolley() {
RequestQueue requestQueue = Volley.newRequestQueue(this);
String JSONDataUrl = "网络地址";

JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(
Method.GET,JSONDataUrl,null,
new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
 System.out.println("response="+response);
}
} catch (JSONException e) {
e.printStackTrace();
}
}

},new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError arg0) {
System.out.println("sorry,Error");
}
});
requestQueue.add(jsonObjectRequest);
}

先获取json数组中其中一个json对象,再获取对象中的元素

Volley获取json数组

原文:http://www.cnblogs.com/chhom/p/4726423.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!