0
私はという短いプログラムを書いてに値をロードすることによって、Preferences
の動作を学びたいと思っています。 getString
を使用して値をロードすると、boardstr
の値は変更されません。データを保存するために環境設定を使用しようとしているAndroid
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
はトリックをしたこと、ありがとうございます! –