Using Loaders in RunTracker

RunTracker currently loads three chunks of data: the list of runs (a RunCursor), an individual Run, and that run’s latest Location. Each of these comes from the SQLite database, and should therefore be moved to a Loader to create a smooth user experience.

In the following sections, you will create two abstract subclasses of AsyncTaskLoader. The first, SQLiteCursorLoader, is a simplified version of the framework’s CursorLoader that will work with a Cursor coming from any source. The second is DataLoader<D>, which is capable of loading any kind of data and simplifies the use of AsyncTaskLoader for subclasses.

Get Android Programming: The Big Nerd Ranch Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.