basicnamevaluepairs with arraylist
Hi I want to post a ArrayList with the namevaluepairs from my androidapp.
It seems that the only way to this is to post a String. Whats the solution?
public JsonUpdateBrands(ArrayList<Integer> selectedIds, String userid,
String webpage) {
super();
ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
nameValuePairs.add(new BasicNameValuePair("serviceId", selectedIds)开发者_如何学Go);
nameValuePairs.add(new BasicNameValuePair("userId", userid));
nameValuePairs.add(new BasicNameValuePair("action", "Subscription"));
progress(nameValuePairs, webpage);
}
Serialized the list of objects into a String and you're good to go.
Maybe a JSON String would be a good idea. Jackson is a terrific Java-to-JSON serializer. Give it a look.
精彩评论