I am new to android developing. And i have searched for this answer. Here’s what i know:
- Both AsyncTask and AsyncTaskLoaders do background processing in Android.
- The AsyncTaskLoader framework uses AsyncTask.
- In most cases, it’s better to perform background processes with the loader instead of Asynctask.
- AsyncTask has limitations such as destroying and recreating an activity during orientation changes and other configuration changes. And you can run out of memory of old AsyncTasks dwell in the system.
- You CAN use AsyncTask for short or interruptible tasks, tasks that don't need to report back to UI or user, and low-priority tasks that can be left unfinished. All other tasks need to be handled with the Loader.
My question is, do we only use one or the other in the same project or can we use both to handle different processes? If we can use both, can you give an example? If not, can you elaborate?