我是新來的異步任務。我需要在我的應用程序中使用httppost。請幫助我使用異步任務來處理以下代碼。從的AsyncTask請給我結構代碼如何使用異步任務來操縱httppost android
HttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost("url here");
httpPost.addHeader("Content-Type", "application/xml");
try {
HttpResponse response = httpClient.execute(httpPost);
BufferedReader reader = new BufferedReader(
new InputStreamReader(response.getEntity()
.getContent(), "UTF-8"));
StringBuffer responseString = new StringBuffer("");
String line;
while ((line = reader.readLine()) != null) {
responseString.append(line);
}
System.out.println("respose QQQQQQQQQQQ");
System.out.println("11response "
+ responseString.toString());
} catch (ClientProtocolException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
謝謝你文卡塔克裏希納 – vinuonline 2012-03-27 07:09:12