您好我正在尝试将 ArrayList 作为 POST 请求的参数从我的 Android 应用程序发送到服务器。到目前为止,我有这个代码:
HttpResponse response;
List<NameValuePair> postParams = new ArrayList<NameValuePair>(2);
postParams.add(new BasicNameValuePair("post[text]", text));
postParams.add(new BasicNameValuePair("post[common_comments]", String.valueOf(commonComments));
postParams.add(new BasicNameValuePair("post[wall_ids]", wallIds);
UrlEncodedFormEntity encodedParams;
try {
encodedParams = new UrlEncodedFormEntity(postParams);
post.setEntity(encodedParams);
} catch (UnsupportedEncodingException e1) {
e1.printStackTrace();
}
但 BasicNameValuePair 只接收 String 作为值。有什么方法可以发送一个 ArrayList 作为 post[wall_ids] 的值吗?
提前致谢。