码迷,mamicode.com
首页 > 编程语言 > 详细

Volley获取json数组

时间:2015-08-13 11:42:20      阅读:230      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!