Abstract
Android offers a robust and flexible framework for dealing with preferences. And by Preferences, we mean those feature choices that a user makes and saves to customize an application to their liking. For example, if the user wants a notification via a ringtone or vibration or not at all, that is a preference the user saves; the application remembers the choice until the user changes it. Android provides simple APIs that hide the reading and persisting of preferences. It also provides prebuilt user interfaces that you can use to let the user make preference selections. Because of the power built in to the Android preferences framework, we can also use preferences for more general-purpose storing of application state, to allow our application to pick up where it left off for example, should our application go away and come back later. As another example, a game’s high scores could be stored as preferences, although you’ll want to use your own UI to display them.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
Rights and permissions
Copyright information
© 2012 Satya Komatineni and Dave MacLean
About this chapter
Cite this chapter
Komatineni, S., MacLean, D. (2012). Working with Preferences and Saving State. In: Pro Android 4. Apress. https://doi.org/10.1007/978-1-4302-3931-4_13
Download citation
DOI: https://doi.org/10.1007/978-1-4302-3931-4_13
Publisher Name: Apress
Print ISBN: 978-1-4302-3930-7
Online ISBN: 978-1-4302-3931-4
eBook Packages: Professional and Applied ComputingApress Access BooksProfessional and Applied Computing (R0)