Hello,

How can i use Asynctask for the following code:


public static String getXML()  {

                        String line = null;

                        DefaultHttpClient httpClient = new DefaultHttpClient();
                        HttpPost httpPost = new 
HttpPost("http://someurl/index.xml";);
                        try {
                        HttpResponse httpResponse = 
httpClient.execute(httpPost);
                        HttpEntity httpEntity = httpResponse.getEntity();
                        line = EntityUtils.toString(httpEntity);

                } catch (UnsupportedEncodingException e) {
                        line = "<results status=\"error\"><msg>Can't connect to 
server</
msg></results>";
                } catch (MalformedURLException e) {
                        line = "<results status=\"error\"><msg>Can't connect to 
server</
msg></results>";
                } catch (IOException e) {
                        line = "<results status=\"error\"><msg>Can't connect to 
server</
msg></results>";
                }

                return line;

                }

this basicaly gets an xml from the website


Thanks in advance

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to