Android Tip: Preferences - Easier Than Using a Database - With Code Sample!


Software License Fine Print

Creative Commons LicenseThis code is licensed as-is, with no warranty or guarantee, under a Creative Commons Attribution 3.0 Unported License.

You may use this code however you want, even in commercial products, but only if you include attribution to me, Richard Peacock, as the original author of this small portion of code, but not in a way that implies I endorse your project.

For example, on a Help/Credits screen:  Portions of this project were based on work freely obtained from these developers: Richard Peacock (, NAME HERE, etc.  These outside developers neither endorse nor support this software.

If you use this code, feel free to email me to let me know!  I'll include a link to your project here.

Can I have Hidden fields in

Can I have Hidden fields in Preferences. they should not be visible to the user but app should be able to read & write values to those fields.

Sure, that's exactly what I

Sure, that's exactly what I am describing in the post. Instead of setting up a preferences activity, you just access them directly, like a database.