Hi I'm trying to send an ArrayList as a parameter for a POST request from my Android app to a server. So far I have this code:
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();
}
but BasicNameValuePair only receives String as value. Is there any way I can send an ArrayList as a value for post[wall_ids]?
Thanks in advance.
Bueno días Carla.
I don´t know if you had resolve this (two months is a lot of time)... but maybe it can help you:
It would also be good to use the "utf 8" format, if you want to use latin characters (this will make to forget on the server), something like:
I have a question about the List constructor... why do you use 2 as argument for it??
PS: I would like to make a coment and not an answer, because I don´t know if it could work as you want.