Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Convert AsyncTask to IntentService #3299
We discussed with some Android experts and they agree with this issue, and claim that AsyncTask can be considered only for short tasks (less than 1 second). However, using IntentService (or AsyncTaskLoader) can avoid such problems since their lifecycles are independent from
I refactored 9 AsyncTasks in
IntentService is too cumbersome and heavy handed. If your inner class isn't static (whether an asynctask or a loader), it will retain a reference to the parent activity, which I assume is what you're trying to avoid. If the task references an instance variable of the enclosing class, that needs to be passed as an argument instead or handled by the callback.