//volley发送post请
2 private void volleypost() {
3 String url = "http://apis.juhe.cn/idcard/index?";
4 StringRequest request = new StringRequest(Request.Method.POST, url, new Response.Listener<String>() {
5 @Override
6 public void onResponse(String s) {
7
8 Log.i("aa", "post请求成功" + s);
9 Toast.makeText(MainActivity2.this, s, Toast.LENGTH_LONG).show();
10 }
11 }, new Response.ErrorListener() {
12 @Override
13 public void onErrorResponse(VolleyError volleyError) {
14 Log.i("aa", "post请求失败" + volleyError.toString());
15 Toast.makeText(MainActivity2.this, volleyError.toString(), Toast.LENGTH_LONG).show();
16 }
17 }) {
18 @Override
19 protected Map<String, String> getParams() throws AuthFailureError {
20 HashMap<String, String> map = new HashMap<>();
21 map.put("key", "bb97bfce9edee938aeac99cb503b76db");
22 map.put("cardno", "43052419910615");
23 return map;
24 }
25 };
26 request.setTag("volleypost");
27 MyApplication.getHttpQueue().add(request);
28 }
05-01 00:52