The Loader
framework in Android does a wonderful job of making it easy to load data in the background and deliver it to the main thread when it is ready.
In this chapter we learned about the essential characteristics of all Loaders—background loading, caching of loaded data, and a managed lifecycle.
We took a detailed look at AsyncTaskLoader
as a means to perform arbitrary background loading, and CursorLoader
for asynchronous loading from local database Cursors.
We saw that Loaders can free us from some of the constraints imposed by the Activity
lifecycle, and took advantage of that to continue to work in the background even across Activity
restarts.
In the next chapter we'll free ourselves completely from the constraints of the Activity
lifecycle and perform long-running background operations with IntentService
, even when our app is no longer in the foreground.
3.139.81.143