问题
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!
回答1:
I'd use a single SharedPreferences object + an array of preference keys that would get prefixed for different configurations + a simple helper class.
来源:https://stackoverflow.com/questions/3233429/managing-multiple-sharedpreference-files