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