The following is the first few sections of a chapter from Exploring Android, plus headings for the remaining major sections, to give you an idea about the content of the chapter.
So far, we have been content to have our to-do items vanish when we re-run our app. This was simple and easy to write. However, it is not realistic. Users will expect their to-do items to remain until deleted. To do that, we need our items need to survive process termination, and that requires that we save those items somewhere, such as on disk.
In this tutorial, we will start in on that work, setting up database support using Room, a Google-supplied framework that layers atop Android’s native SQLite support. SQLite is a relational database. Through Room, we will create a database containing a table for our to-do items.
In truth, this app is trivial enough that you could use something simpler for storage, such as storing the items in a JSON file. The bigger the app, the more likely it is that SQLite and Room will be better options for you.
This is a continuation of the work we did in the previous tutorial. The book’s GitHub repository contains the results of the previous tutorial as well as the results of completing the work in this tutorial.
Google has official documentation for Room, though it seems to have lost its former documentation for SQLite itself.
You can read more about SQLite in The Busy Coder’s Guide to Android Development, specifically in:
You can read more about Room in several chapters of Android’s Architecture Components, including:
The preview of this section is being chased by zombies.
The preview of this section was lost in the sofa cushions.
The preview of this section was stepped on by Godzilla.
The preview of this section was fed to a gremlin, after midnight.
The preview of this section is en route to Mars.