Chapter 12
Getting Persistent with Data Storage
In This Chapter
Discovering data-storage media
Getting user permissions
Creating an SQLite database
Querying your database
In certain types of applications, Android requires application developers to use data persistence, where information about a user’s preferences, such as favorite background colors or radio stations, is saved on the device for reuse later, after the device is turned off and then on again. For example, the Task Reminder application wouldn’t be useful if it didn’t save tasks, would it? Thankfully, the Android platform (in combination with Java) provides a robust set of tools that you can use to store user data.
This chapter delves deeply into creating and updating an SQLite database and producing a ContentProvider
to access it. You need to be familiar with a certain level of database theory to tackle the data storage tasks in this chapter.
This chapter is code-intensive — if you start feeling lost, you can download the completed application source code from this book’s website.