我创建SharedPreference OBJ使用下列内容: 注:在相同的首选项文件名创建喜好的数量android共享偏好存储多个值;
public static Sting name = "abx"; //pref file name
spo = context.getsharedpreference(name , mode_private);
editor = spo.edit(); //get the editor associated with pref obj
Map<String, String> test= new HashMap<String, String>();//create a map
test.put("1", "abc");//fill the values
test.put("2", "efg");//used map because values are stored in key -value pairs
test.put("3", "ghj");
for (String s : test.keySet()) {
// use the name as the key, and the icon as the value
editor.putString(s, nameIcons.get(s));//use the key as preference name
}
editor.commit();//commit the preferences
我有一个疑问,请纠正我,如果我错了,有名字SharedPreference文件“ABZ”是创建并在此文件中的首选项值存储为键值对,或者如果编辑器obj为每个键创建新的首选项文件,在创建共享首选项对象时提供pref文件名的用法是什么?