I have a nested AsyncTask. This simple example is proof that they work: http://pastebin.com/0R9Cfxx1
However, in my production code, my nested AsyncTask returns getStatus == AsyncTask.RUNNING
yet, doInBackground() does not execute.
How can this be?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The way I understand AsyncTask, you’re supposed to run it from the main application thread, which creates a separate thread where “doInBackground()” runs. Now, if you run a nested AsyncTask inside another AsyncTask, you would have a minimum of three threads total: main app thread, first AsyncTask thread and second AsyncTask thread. They will all run in parallel, which breaks the idea of “nestedness”.
I believe the best way would be to refactor your code to use only one AsyncTask.