0
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,安卓:发送HTTP POST请求并提供多个值Web服务器
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和字符串数据值。我如何使用一个HTTP发布请求发送多个ID?
你可以得到任何解决方案,因为我要求我有id,stringdata等ArrayList,我想发布这个所有arralist数据单连接 – PankajAndroid 2013-11-18 04:36:20