/** Post的MultipartRequest(文本,图片,文件)(直接解析结果) */ public static NetworkResponse RequestMultipartTickle( Context context, String url, String tag, Map<String, String> map_string, Map<String, String> map_file, VolleyInterface vif) { RequestTickle mRequestTickle = VolleyTickle.newRequestTickle(context); simpleMultiPartRequest = new SimpleMultiPartRequest(Request.Method.POST, url, null, null); if (map_string != null) { Iterator iter = map_string.entrySet().iterator(); while (iter.hasNext()) { Map.Entry entry = (Map.Entry) iter.next(); Object key = entry.getKey(); Object val = entry.getValue(); simpleMultiPartRequest.addMultipartParam((String) key, null, (String) val); } } if (map_file != null) { Iterator iter = map_file.entrySet().iterator(); while (iter.hasNext()) { Map.Entry entry = (Map.Entry) iter.next(); Object key = entry.getKey(); Object val = entry.getValue(); simpleMultiPartRequest.addFile((String) key, (String) val); } } simpleMultiPartRequest.setTag(tag); mRequestTickle.add(simpleMultiPartRequest); NetworkResponse response = mRequestTickle.start(); return response; }
/** 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; }