This will be my fourth and final post on Loaders and the LoaderManager. Let me know in the comments if they have been helpful! Links to my previous Loader-related posts are given below:
- Part 1: Life Before Loaders
- Part 2: Understanding the LoaderManager
- Part 3: Implementing Loaders
- Part 4: Tutorial: AppListLoader
Due to public demand, I’ve written a sample application that illustrates how to correctly implement a custom Loader.
The application is named AppListLoader,
and it is a simple demo application that queries and lists all installed applications on your Android device.
The application is a modified, re-thought (and bug-free) extension of the
sample that is provided in the API Demos. The application uses an
(a subclass of
AsyncTaskLoader) to query its data, and the LoaderManager to
manage the Loader across the Activity/Fragment lifecycle: