Send POST request with JSON data using Volley

前端 未结 8 693
梦谈多话
梦谈多话 2020-11-22 12:07

I would like to send a new JsonObjectRequest request:

  • I want to receive JSON data (response from server): OK
  • I want to send JSON form

8条回答
  •  心在旅途
    2020-11-22 12:53

    protected Map getParams() {
       Map params = new HashMap();
    
       JSONObject JObj = new JSONObject();
    
       try {
               JObj.put("Id","1");
               JObj.put("Name", "abc");
    
       } catch (Exception e) {
           e.printStackTrace();
       }
    
       params.put("params", JObj.toString());
       // Map.Entry
       Log.d("Parameter", params.toString());
       return params;
    }
    

提交回复
热议问题