Hi,
I'm using the following method to open a url and download:
public class MyWebRequest
{
public HttpGet httpget;
public void get(String url) {
httpget = new HttpGet(url);
DefaultHttpClient httpclient = new DefaultHttpClient();
HttpResponse response = httpclient.execute(httpget);
InputStream is = response.getEntity().getContent();
StringBuilder sb = new StringBuilder(500);
int c = -1;
while ((c = is.read()) != -1) {
sb.append((char)c);
}
return sb.toString();
}
}
instances of this class are created and run in a background thread. If
I need to abort the operation, can I simply do this from another
thread safely:
MyRequestObject.httpget.abort();
is the abort() method thread-safe? If another thread calls abort()
before any work is actually done, that's still ok right? The request
will just immediately fail?
Thanks
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---