Put ArrayList into param JsonObject

前端 未结 3 1430
再見小時候
再見小時候 2020-12-19 11:30

i must do i request with Volley Framework. This is a POST request with JSONObject.

I must pass one string and one JSONArray..but how i can?

I start with this

3条回答
  •  一个人的身影
    2020-12-19 12:25

    try passing JSONObject instead of hashmap

    JSONObject params = new JSONObject();
    params.put("url", "www.secret.com");
    
    JSONArray urlDove = new JSONArray();
    urlDove.put("www.google.com");
    urlDove.put("www.yahoo.com");
    
    params.put("urlDove", urlDove);
    
    
    JsonObjectRequest mRequest = new JsonObjectRequest(
                    mUrl, params,
                    createMyReqSuccessListener(),
                    createMyReqErrorListener()) {
                @Override
                public Map getHeaders() throws AuthFailureError {
                    return app.getInstance().createBasicAuthHeader();
                }
            };
    

    for reference in parsing json https://stackoverflow.com/a/17810270/4810752

提交回复
热议问题