You may not like my answer, but I find AsyncTask broken (for reasons like this).
Edit: My initial answer recommended using IntentService and translating the result. It is as inefficient as sending a letter to yourself.
You can use AsyncTaskLoader , which works around AsyncTask problems, but the AsyncTaskLoader API AsyncTaskLoader far from excellent. In particular, you must ensure that the bootloader identifier is unique, and keep in mind that the results are cached for the identifier and not for the arguments. In addition, the exception propagation is the same as with AsyncTask .
A more modern and safer way to solve the problem is to use the future of Guava .
source share