11 Databases and the Room Library

Almost every application needs a place to save data for the long term. In this chapter you will implement a database for CriminalIntent and seed it with dummy data. Then you will update the app to pull crime data from the database and display it in the crime list (Figure 11.1).

Figure 11.1  Displaying crimes from the database

Displaying crimes from the database

In Chapter 4 you learned how to persist transient UI state data across rotation and process death using ViewModel and saved instance state. These two approaches are great for small amounts of data tied to the UI. However, these approaches should not be used for ...

Get Android Programming: The Big Nerd Ranch Guide, 4th Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.