I have two total different implementations of AsyncTask
, lets say AT1
and AT2
.
AT1
is executed first, then AT2
is executed. AT1
waits in doInBackground
until AT2
has done its task by polling this data every 500 ms. But this never happens.
So what I basically want is this:
But what seems to happen is this:
Except AT1
is never done, and AT2
is never started.
Is there a way I can force these two AsyncTask
s to be executed on two seperate threads, or is there another solution for this?
It is not possible to first start AT2
and after that execute AT1
.
EDIT
For clarification: AT1
is executed when a user opens a particular screen, and needs to download data for that screen, based on a location. AT2
is executed on Location change, and when that happens, some calculations are made that cannot be done on the UI thread.
When AT2
has never been executed, AT1
has no location to download data for, so it needs to wait for AT2
to finish. When AT2
has been executed, the location data is already there, and AT1
doesn't need to wait.
Also, this problem occurs in ICS, not in Android 2.3, like this answer suggests.