how to process http response and print the string on android screen
I've made a made a application which is deployed on the Google app engine. I've connected it with my android apk using http request and response . Now my response is coming in the form of a string which contain data in form of html Now I want that only the开发者_如何学运维 message from my string should be printed and not the html tags and that to be On the android screen.
What should I do to achieve it??
//the function will return a response String;
private String doHTTPRequest(String url){
String results = "ERROR";
try
{
HttpClient hc = new DefaultHttpClient();
HttpPost post = new HttpPost(url);
HttpResponse rp = hc.execute(post);
if(rp.getStatusLine().getStatusCode() == HttpStatus.SC_OK)
{
results = EntityUtils.toString(rp.getEntity());
}
}catch(IOException e){
e.printStackTrace();
}
return results;
}
精彩评论