Search code examples
androidpreferences

Managing multiple SharedPreference files


I'm looking for a good way to manage multiple SharedPreference files. Basically the user should be able to create, edit, and delete the preference files and then select the one they want from a spinner.

What I'm trying to figure out is how do I find all of the preference files that the app has? Is there a way to scan the directory and return the names of all of the preference files?

I'm thinking that once I get a lits of all of the names I could create a string array with all of the names and feed it to the spinner.

Thanks for the help!


Solution

  • I'd use a single SharedPreferences object + an array of preference keys that would get prefixed for different configurations + a simple helper class.