Volley编程,首先创建请求队列,然后创建请求,最后将请求加入请求队列中发送请求。
public void getJSONVolley(){ // // RequestQueue requestQueue=Volley.newRequestQueue(this); // // // // String JSONData="http://fanyi.youdao.com/openapi.do?keyfrom=aadssdss&key=415067552&type=data&doctype=<doctype>&version=1.1&q=good"; // JsonObjectRequest jsonObjectRequest=new JsonObjectRequest(Request.Method.GET, JSONData, null, // new Response.Listener<JSONObject>() { // @Override // public void onResponse(JSONObject jsonObject) { // // System.out.println(jsonObject+"请求成功"); // } // }, new Response.ErrorListener() { // @Override // public void onErrorResponse(VolleyError volleyError) { // System.out.println(volleyError+"请求失败"); // } // }); // requestQueue.add(jsonObjectRequest); // }