我将有三个SharedPreferences:
private SharedPreferences cakes, tarts, pies;
private SharedPreferences.Editor editor;
....
cakes = getSharedPreferences("cakes", MODE_PRIVATE);
tarts = getSharedPreferences("tarts", MODE_PRIVATE);
pies = getSharedPreferences("pies", MODE_PRIVATE);
....
editor = cakes.edit();
editor.putLong("date", Shane.getTime());
editor.commit(); // <--- does this let me use editor again, like so:
editor = tarts.edit();
editor.putLong("date", Shane.getTime());
editor.commit();
...and so on
只要我将更改提交给SharedPreferences,我可以继续调用editor = *.edit();
吗?
提前致谢
答案 0 :(得分:1)
是。您完成交易所需要做的就是调用commit
。