07.1 AsyncTask and AsyncTaskLoader
07.1 AsyncTask and AsyncTaskLoader
Background
Tasks
Lesson 7
● Threads
● AsyncTask
● Loaders
● AsyncTaskLoader
WAIT
● AsyncTask
● The Loader Framework
Do some
● Services Worker Thread work
AsyncTask and This work is licensed under a
Android Developer AsyncTaskLoad
Creative Commons Attribution 4.0 9
Fundamentals V2 International License
Two rules for Android threads
Worker Thread
doInBackground()
● onProgressUpdate()
○ Runs on the main thread
○ receives calls from publishProgress() from background
thread
LoaderManager
Request Receive
Work Result
Activity
AsyncTask and This work is licensed under a
Android Developer AsyncTaskLoad
Creative Commons Attribution 4.0 31
Fundamentals V2 International License
AsyncTask
AsyncTaskLoader
doInBackground() loadInBackground()
onPostExecute() onLoadFinished()
@Override
public Loader<List<String>> onCreateLoader(int id, Bundle args)
{
return new
StringListLoader(this,args.getString("queryString"));
}
@Override
public void onLoaderReset(final LoaderList<String>> loader) { }
● Concept Chapter:
7.1 AsyncTask and AsyncTaskLoader
● Practical: 7.1 AsyncTask