2012-06-26 51 views
0

我想發表評論表單,以便從Android應用程序向基於Wordpress的網站提交評論。 這是我第一個Android應用程序,我從來沒有這樣做過,所以任何建議都會很棒。Android中的評論表格

我想我可以使用Http請求發送發佈數據?

回答

0

乘坐namevalue對,並添加keyid的公司,其價值在給定的格式

 nameValuePairs.add(new BasicNameValuePair("Cmnt_Key", strcmnt)); 

通過鏈接的URL及以下

 public static HttpResponse postData(String strUrl, List<NameValuePair> nameValuePairs) 
{ 
    // Create a new HttpClient and Post Header 
    HttpClient httpclient = new DefaultHttpClient(); 
    HttpPost httppost = new HttpPost(strUrl); 
    try 
    { 
     // Add your data 
     httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); 

     // Execute HTTP Post Request 
     response = httpclient.execute(httppost); 


    } 
    catch (ClientProtocolException e) 
    { 
     // TODO Auto-generated catch block 
    } 
    catch (IOException e) 
    { 
     // TODO Auto-generated catch block 
    } 
    return response; 
}