管理多个共享preference文件 [英] Managing multiple SharedPreference files
问题描述
我在寻找能够管理多个共享preference文件的好方法。基本上,用户应该能够创建,编辑和删除preference文件,然后选择他们从微调想要的。
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.
我试图弄清楚是怎么做的,我觉得所有的应用程序有preference的文件?有没有扫描目录,并返回所有preference文件的名称的方式?
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.
感谢您的帮助!
推荐答案
我会使用一个单一的共享preferences宾语+ preference键所组成的数组将获得prefixed不同配置+ A简单的辅助类。
I'd use a single SharedPreferences object + an array of preference keys that would get prefixed for different configurations + a simple helper class.
这篇关于管理多个共享preference文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!