34,333
edits
Changes
no edit summary
Included with the Android Architecture Components, the Room persistence library is designed specifically to make it easier to add database storage support to Android apps in a way that is consistent with the Android architecture guidelines. With the basics of SQLite databases covered in the previous chapter, this chapter will explore the basic concepts behind Room-based database management, the key elements that work together to implement Room support within an Android app and how these are implemented in terms of architecture and coding. Having covered these topics, the next two chapters will put this theory into practice in the form of an example Room database project.
== Revisiting Revisiting Modern App Architecture ==
The chapter entitled [[Modern Android App Architecture with Jetpack]] introduced the concept of modern app architecture and stressed the importance of separating different areas of responsibility within an app. The diagram illustrated in Figure 66-1 outlines the recommended architecture for a typical Android app:
In this example, the method is passed a string value which is, in turn, included within an SQL statement by prefixing the variable name with a colon (:).
<htmlet>androidstudio32</htmlet>
A basic insertion operation can be declared as follows using the @Insert convenience annotation: