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 sleeping in.

Using CursorLoader

The preview of this section left for Hollywood to appear in a reality TV show.

What Else Is Missing?

The preview of this section is sleeping in.

What Happens When…?

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

Writing a Custom Loader

The preview of this section is presently indisposed.