我正在尝试使用 HttpClient API 对服务器进行 JSON 调用。代码片段如下所示。
HttpClient httpClient = new DefaultHttpClient();
HttpGet httpPost = new HttpPost(URLString);
HttpResponse response = httpClient.execute(httpPost);
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
nameValuePairs.add(new BasicNameValuePair("method", "completeUserLogin"));
String[] params = new String[]{"100408"};
response = httpClient.execute(httpPost);
我想将参数添加到 nameValuePairs。BasicNameValuePair 类不允许您添加数组。有什么想法吗?
提前致谢!