0

I'm starting an Activity with an Intent. This Intent contains a Serializable Object which is then sent to a server in the onCreate method in order to get the response to display.

I'd like to be able to do the following: When i close the Activity the task doing the web request should be destroyed, in case it hasn't finished yet.

I'm using a synchronous Web Request Library (Spring). So AsyncTask's cancel wouldn't help since i cannot afford to loop. Is there a way to destroy an AsyncTask instantaneously?

Luiggi Mendoza
  • 85,076
  • 16
  • 154
  • 332
ndrizza
  • 3,285
  • 6
  • 27
  • 41
  • http://stackoverflow.com/questions/16538714/stop-asynctask-doinbackground-method/16538887#16538887. Check the link might help you. – Raghunandan May 27 '13 at 17:31
  • @Dave: LOL! so simple. – ndrizza May 27 '13 at 18:47
  • i've already seen that link. however, cancel doesn't let me quit the synchronous http request instantly. since cancel relies on checking regularly isCanceled() – ndrizza May 27 '13 at 18:48

0 Answers0