There are many higher level components, both in the Android SDK and in open-source libraries, that implement asynchronous programming techniques. When you use these tools, you don’t have to create your own threads or AsyncTask objects; the API is doing it for you. One important example is the Loader architecture.
- [Instructor] There are many higher level components…both in the Android SDK and in open source libraries…that implement asynchronous programming techniques.…When you use these tools,…you don't have to create your own threads…or async task objects.…The API does it for you.…One important example is the loader architecture.…Loaders have been part of Android since its early days.…A loader let's you acquire data in a background thread…and provide it to view components,…such as ListView and RecyclerView.…
Typical sources of data for loaders include web services,…local data in the device's persistent storage,…and data from content providers…that are managed by other apps on the device.…In this demonstration, I'm going to use a cursor loader,…a loader that retrieves data from some data source…and provides access to it through a cursor object,…and I'll get the data from the device's contacts repository,…a data source that's connected to a Google account.…Now, retrieving that sort of data requires a permission,…and in this application's manifest…
First, discover how to create and start simple background threads, and how to use handlers to manage a thread's message queue. Then, learn various methods for optimizing the scheduling and performance of background tasks in Android with AsyncTask, intent services, and the JobScheduler API. Plus, explore tools that help you implement multithreading for different tasks in Android: Loader, for asynchronous data loading, and the open-source API Retrofit, for making HTTP requests.
Note: To get the most out of this course, you should be comfortable programming with Java, and should understand the most basic skills that are needed to build Android apps with the Android SDK and Android Studio.
- Creating and running a background thread
- Sending messages to the UI from threads
- Managing multiple background threads
- Managing threads with AsyncTask
- Managing long-running tasks with services
- Scheduling background tasks with JobScheduler
- Using other APIs for concurrent programming