The following is the first few sections of a chapter from The Busy Coder's Guide to Android Development, plus headings for the remaining major sections, to give you an idea about the content of the chapter.


The Loader Framework

A perpetual problem in Android app development is getting long-running work off of the main application thread. In modern times, we have lots of flexible solutions for this.

Another problem in Android app development is holding onto data across configuration changes. In modern times, we have lots of flexible solutions for this as well.

However, back in 2011, we did not have nearly as many options. To try to fill the gap, Android 3.0 introduced the Loader framework. A Loader is an abstraction around loading data and retaining it across configuration changes.

In truth, the Loader framework never became particularly popular. The one scenario where it is worth exploring is when you are trying to query a ContentProvider from an activity or fragment. That scenario is what we will focus on in this chapter.

Prerequisites

Understanding this chapter requires that you have read the chapters on:

Introducing the Loader Framework

The preview of this section is out seeking fame and fortune as the Dread Pirate Roberts.

Using CursorLoader

The preview of this section was lost in the sofa cushions.

What Else Is Missing?

The preview of this section is en route to Mars.

What Happens When…?

The preview of this section is unavailable right now, but if you leave your name and number at the sound of the tone, it might get back to you (BEEEEEEEEEEEEP!).

Writing a Custom Loader

The preview of this section was accidentally identified as an Android 'tasty treat' by the Cookie Monster.