Chapter 7Data Persistence
This chapter describes how to persist data in your Android applications. Persisting data is an important topic in application development because users typically expect to reuse data in the future. For Android, there are primarily three basic ways of persisting data:
- A lightweight mechanism known as shared preferences to save small chunks of data
- Traditional file systems
- A relational database management system through the support of SQLite databases
The techniques discussed in this chapter enable applications to create and access their own private data. Chapter 8 shows you how to share data across applications.
SAVING AND LOADING USER PREFERENCES
Android provides the SharedPreferences object to help you save simple application data. For example, your application may have an option that enables users to specify the font size used in your application. In this case, your application needs to remember the size set by the user so that ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access