As an old version of volley.jar. I pass params by following method:
@Override
public byte[] getBody() {
if (params != null && params.size() > 0) {
return encodeParameters(params, getParamsEncoding());
}
return null;
}
But I need to update volley, and find that this method(encodeParameters()) was changed to private.
I also found that to override the method of getParams(), which did not work for me. the Method getBody of JsonObjectRequest is as following:
public byte[] getBody() {
try {
return mRequestBody == null ? null : mRequestBody.getBytes(PROTOCOL_CHARSET);
} catch (UnsupportedEncodingException uee) {
VolleyLog.wtf("Unsupported Encoding while trying to get the bytes of %s using %s",
mRequestBody, PROTOCOL_CHARSET);
return null;
}
}
getParams() would never be called. so I cannot pass the params now.
I also tried to pass the params in the construct method which has JsonObject param, but it did not work either.