12 Coroutines and Databases
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. However, reading and writing to a database is a slow process (in the scale at which computers operate), so first you will learn how to perform operations asynchronously – allowing multiple tasks to run at the same time.
Once you understand the basics of working with asynchronous code on Android and you have implemented the database, you will update the app to pull crime data from the database and display it in the crime list (Figure 12.1).
Figure 12.1 Displaying crimes from the database
Get Android Programming: The Big Nerd Ranch Guide, 5th 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.