如何发布多个参数android Volley
**发布多个数组,如101,102,103 params.put(“sessionid”,101,102,103); //就像**
任何其他方式
public void postCompanyArticle() {
StringRequest stringRequest = new StringRequest(Request.Method.POST, config.postArticleTopBiz(), new Response.Listener<String>() {
@Override
public void onResponse(String response) {
list = parseResponse(response);
adapter.setList(list);
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
errorJson.setVisibility(View.VISIBLE);
String msg = VolleyException.getErrorMessageFromVolleyError(error);
errorJson.setText(msg);
}
}) {
@Override
protected Map<String, String> getParams() throws AuthFailureError {
Map<String, String> params = new HashMap<>();
params.put("sessionid", 101,102,103);//as like
params.put("EntID", "7");
params.put("offset", String.valueOf(countView));
params.put("limit", "10");
params.put("LastLoginTime", "2016-02-01");
return params;
}
};
requestQueue.add(stringRequest);
}
答案 0 :(得分:1)
只需使用for循环就可以了。
@Override
protected Map<String, String> getParams() throws AuthFailureError {
Map<String, String> params = new HashMap<>();
for(int i=0; i < arraylist.size; i++)
{
params.put("sessionid["+i+"]",String.valueOf(arraylist.get(i)));
}
params.put("EntID", "7");
params.put("offset", String.valueOf(countView));
params.put("limit", "10");
params.put("LastLoginTime", "2016-02-01");
return params;
}
arraylist是您的sessionid列表。这对我有用。