2012-06-26 43 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; 
}