3 回答

TA貢獻(xiàn)1825條經(jīng)驗(yàn) 獲得超6個(gè)贊
假設(shè)首選項(xiàng)是world_readable,這可能會(huì)奏效:
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貢獻(xiàn)1789條經(jīng)驗(yàn) 獲得超8個(gè)贊
- 3 回答
- 0 關(guān)注
- 369 瀏覽
添加回答
舉報(bào)