Managing multiple SharedPreference files

拥有回忆 提交于 2019-12-24 07:33:40

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!