The reason you cannot call the two .execute() AsyncTask on AsyncTask in the same project at the same time is the modification introduced by Android with Gingerbread . Prior to this version, you could call .execute() as many times as you need, since each of them ran in a separate Thread .
But with this version they are called sequentially, so if one of them is executed, the other does not start if you just call .execute() .
So basically all you have to do is check the version of the device that AsyncTask running AsyncTask and run a command depending on it.
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.HONEYCOMB_MR1) your_asynctask.execute(your_params); else your_asynctask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, your_params);
More details here .
By the way, the lines The application may be doing too much work on its main thread. not affiliated with AsyncTask . These tasks are performed in the background, and if you do the work in your doInBackground() method, this is not a problem.
It may be slightly different if you are doing some work in your onPostExecute() task, as this may be related to your main user interface, but we cannot tell you more without knowing what code you are using.
source share