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