/** Get的StringRequest(通过接口回调处理成功和失败的结果) */ public static void RequestGet(Context context, String url, String tag, VolleyInterface vif) { ApplicationController.cancelPendingRequests(tag); stringRequest = new StringRequest(Request.Method.GET, url, vif.loadingListener(), vif.errorListener()); stringRequest.setTag(tag); ApplicationController.getRequestQueue().add(stringRequest); }
/** Post的StringRequest(通过接口回调处理成功和失败的结果) */ public static void RequestPost( Context context, String url, String tag, final Map<String, String> params, VolleyInterface vif) { ApplicationController.cancelPendingRequests(tag); stringRequest = new StringRequest(Request.Method.POST, url, vif.loadingListener(), vif.errorListener()) { @Override protected Map<String, String> getParams() throws AuthFailureError { return params; } }; stringRequest.setTag(tag); ApplicationController.getRequestQueue().add(stringRequest); }
/** Post的StringRequest(直接解析结果) */ public static NetworkResponse RequestPostTickle( Context context, String url, String tag, final Map<String, String> params, VolleyInterface vif) { RequestTickle mRequestTickle = VolleyTickle.newRequestTickle(context); stringRequest = new StringRequest(Request.Method.POST, url, null, null) { @Override protected Map<String, String> getParams() throws AuthFailureError { return params; } }; stringRequest.setTag(tag); mRequestTickle.add(stringRequest); NetworkResponse response = mRequestTickle.start(); return response; }