Why use Async HTTP post Android
<p>I currently have this running in my app. The use of this is for users to send me simple messages. A dialog is opened where they can type then when they click send button I want another dialog opened saying processing and finally one opened saying thanks if successful.</p>

<p>Is the only / best way to do this by using asyncTask? And is there a good example/walkthrough anywhere for implementing this as I understand the theory, but not really implementation.</p>

<pre><code>public void postData() {
    HttpParams params = new BasicHttpParams();
    params.setParameter(CoreProtocolPNames.PROTOCOL_VERSION, HttpVersion.HTTP_1_1);
    HttpClient httpclient = new DefaultHttpClient(params);
    HttpPost httppost = new HttpPost("http://www.mysite.com/script.php");

    try {
        List&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt;(2);
        nameValuePairs.add(new BasicNameValuePair("id", "12345"));
        nameValuePairs.add(new BasicNameValuePair("stringdata", messageval));
        httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));

        HttpResponse response = httpclient.execute(httppost);
        responseBody = EntityUtils.toString(response.getEntity());
    } catch (ClientProtocolException e) {
        // TODO Auto-generated catch block
    } catch (IOException e) {
        // TODO Auto-generated catch block
    }    
} 
</code></pre>
