0

我需要发送一个List<Integer>到网络服务

public void SendRequest(String url, List<NameValuePair> postData,
        String httpMethod, Type returnType, WebResponseCallback<T> callback) {

    if (postData != null) {
        url += URLEncodedUtils.format(postData, "UTF-8");
    }
    getRequest = new HttpGet(url);
    this.execute(callback, returnType);
}

public void sendOrderId(String url, List<Integer> postData,
        String httpMethod, Type returnType, WebResponseCallback<T> callback) {

    if (postData != null) {
        url += postData.toString();
    }
    getRequest = new HttpGet(url);
    this.execute(callback, returnType);
}

发送名称值部分可以正常工作。但是List<Integer>传球不起作用。如何将 a 传递List<Integer>给 Web 服务?

4

1 回答 1

1

好吧,您不能传递列表,您只能传递项目列表。您可以使用 JSON。此外,查看您使用 GET 方法的代码,我建议您使用 POST,因为使用 GET 您对要传递的数据大小有限制。

于 2013-11-15T10:18:21.473 回答