开发者

basicnamevaluepairs with arraylist

开发者 https://www.devze.com 2023-02-09 22:11 出处:网络
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?

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消