问题
i am using android volley framework for sending jsonobject request to my server.get request is working fine.now i would like to send a post request with request parameters which is nested hashmap< string,object >.i override the getparams method but it expects me to send hashmap< string,string >.
there is any way to pass hashmap as request parameter?
i have followed this link enter link description here
回答1:
try override below method, it is from source code:
/**
* Returns the raw POST or PUT body to be sent.
*
* @throws AuthFailureError in the event of auth failure
*/
public byte[] getBody() throws AuthFailureError {
Map<String, String> params = getParams();
if (params != null && params.size() > 0) {
return encodeParameters(params, getParamsEncoding());
}
return null;
}
Returns the raw POST or PUT body to be sent.
so override the getBody() with your parameter.
回答2:
You can use the getParamsEncoding in override method getBody().
Here, this link will help you.
来源:https://stackoverflow.com/questions/27561421/sending-volley-request-with-nested-hashmap-parameters