I’m developing an app that requires multiple files being downloaded simultaneously. I am creating an AsyncTask with its own HttpClient for each file, but the next file only starts downloading after the previous one finished.
Might it be a server-side issue?
It is because AsyncTask management changed in Honeycomb . Previously if you started i.e. 3 AsyncTasks, these were running simultaneously. Since HC, if your
targetSdkis set to12or higher, these are queued and executed one by one (see this discussion). To work that around start your AsyncTasks that way:instead of:
If you target also older Androids, you need conditional code:
or wrap it in a separate helper class:
and usage would be i.e.: