【发布时间】:2014-12-19 07:22:01
【问题描述】:
我正在使用 android volley 框架向我的服务器发送 jsonobject 请求。get 请求工作正常。现在我想发送一个带有嵌套 hashmap
有什么方法可以将 hashmap 作为请求参数传递?
我已关注此链接enter link description here
【问题讨论】:
-
你有答案吗?
标签: android rest android-volley
我正在使用 android volley 框架向我的服务器发送 jsonobject 请求。get 请求工作正常。现在我想发送一个带有嵌套 hashmap
有什么方法可以将 hashmap 作为请求参数传递?
我已关注此链接enter link description here
【问题讨论】:
标签: android rest android-volley
尝试覆盖下面的方法,它来自源代码:
/**
* 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;
}
返回要发送的原始 POST 或 PUT 正文。
所以用你的参数覆盖getBody()。
【讨论】:
您可以在覆盖方法 getBody() 中使用 getParamsEncoding。
这里,link 会帮助你。
【讨论】: