1

I am writing an app that accesses a web site, downloads XML responses and acts on the response.

I have used the solution discussed at How to get the result of OnPostExecute() to main activity because AsyncTask is a separate class?, but due to the limitation of AsyncTask only being able to run once, I cannot reuse the AsyncTask for reading the next XML response required. Is AsyncTask the solution for me, or should I be writing my own threaded activity?

Community
  • 1
  • 1

1 Answers1

1

There's three ways to do it.

1)Create a new AsyncTask in onPostExecute to do the next task.

2)Create multiple AsyncTasks at the beginning if you already know you'll need another

3)If you know you're going to be reading xml all the time, then a Thread rather than AsyncTask is appropriate.

Gabe Sechan
  • 90,003
  • 9
  • 87
  • 127
  • Thread it is. Just wanted to be sure I was't missing something obvious. I've been reading for a couple of days, and your answer has helped me come to the conclusion that I was just being lazy by trying to make AsyncTask do the job. – I.T. Navigate Aug 02 '14 at 06:23