Chapter    26

Understanding Loaders

This chapter looks at loading data from data sources through the recommended mechanism of Loaders. The API of Loaders is designed to deal with two issues with loading data by activities and fragments.

The first is the non-deterministic nature of activities where an activity can be hidden partially or fully, restarted due to device rotation, or removed from memory when in background due to low-memory conditions. These events are called activity life cycle events. Any code that retrieves data must work in harmony with the activity life cycle events. Prior to the introduction of Loaders in 3.0 (API 11), this was handled through Managed Cursors. This mechanism is now discontinued in favor of Loaders.

The second ...

Get Pro Android 5, Fifth Edition 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.