Home » Android » android – When would we want a non-persistent Preference?

android – When would we want a non-persistent Preference?

Posted by: admin June 15, 2020 Leave a comment

Questions:

I’m trying to wrap my head around persistency when it comes to Android preferences. There’s an attribute persistent, which can be either true or false. If true, the preference is committed to shared preferences. How can a preference be used if it’s not persistent?

How to&Answers:

You could (ab-)use Preferences as menu items (make them clickable to launch some other action) or to display some info, e.g. application version etc.

In this case, you don’t want them to be stored in the xml file.