我正在尝试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