3 回答
TA贡献1772条经验 获得超8个赞
假设首选项是world_readable,这可能会奏效:
final ArrayList<HashMap<String,String>> LIST = new ArrayList<HashMap<String,String>>();
// where com.example is the owning app containing the preferences
Context myContext = createPackageContext("com.example", Context.MODE_WORLD_WRITEABLE);
SharedPreferences testPrefs = myContext.getSharedPreferences("test_prefs", Context.MODE_WORLD_READABLE);
Map<String, ?> items = testPrefs .getAll();
for(String s : items.keySet()) {
// do something like String value = items.get(s).toString());
}
TA贡献1942条经验 获得超3个赞
- 3 回答
- 0 关注
- 310 浏览
添加回答
举报