Пример #1
0
  /** 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);
  }
Пример #2
0
 /** 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);
 }