List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
nameValuePairs.add(new BasicNameValuePair("id", "12345"));
nameValuePairs.add(new BasicNameValuePair("stringdata", "AndDev is Cool!"));
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
http://www.androidsnippets.com/executing-a-http-post-request-with-httpclient 我想添加更多的 id 和 stringdatas,
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
nameValuePairs.add(new BasicNameValuePair("id", "12345"));
nameValuePairs.add(new BasicNameValuePair("stringdata", "AndDev is Cool!"));
nameValuePairs.add(new BasicNameValuePair("id", "12348"));
nameValuePairs.add(new BasicNameValuePair("stringdata", "wassup"));
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
当我尝试上面的代码时,服务器只获取最后一个 id 和 stringdata 值。如何使用一个 HTTP Post 请求发送多个 ID?