我正在尝试Preferences
通过编写一个短程序来存储ted
密钥board
然后将值加载到boardstr
. 当我使用getString
加载值时,值boardstr
不会改变。
boardstr= new String();
boardstr="fred";
// set the prefrence to ted
this.getPreferences(MODE_PRIVATE).edit().putString("board","ted");
// kload the prfrence in boardstr
this.getPreferences(MODE_PRIVATE).getString("board",boardstr);
// boardstr stil equals fred, not ted