Chapter 19
Using Preferences
In the previous chapters you learned how to store, modify, and retrieve information from the Android file system and using SQLite databases. Android has multiple ways of storing information that suit many different purposes and goals. One of the simplest pieces of information you may want to store on behalf of your users is a simple preference or option setting. For instance, you may want to store a preference for date format, or a nickname in a chat program.
Using a dedicated file or database for storing very small preference data is overkill, so Android provides the preferences system as a way of storing and using simple key/value items that persist across repeated activity lifecycles. Although the system and ...
Get Beginning Android, Fifth 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.