2011-06-16 99 views

回答

0

使用HttpPost將數據發送到服務器,並使用json來創建一個數組的數組。 nameValuePairs將攜帶數據:

HttpClient httpclient = new DefaultHttpClient(); 
HttpPost httppost = new HttpPost("http://www.yoursite.com"); 

List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(1);   
nameValuePairs.add(new BasicNameValuePair("items", jsonObject)); 

httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); 

HttpResponse response = httpclient.execute(httppost); 

希望這有助於...