看板 AndroidDev 關於我們 聯絡資訊
我看書的程式如下(蓋索林那本) public static final String PREF_HEIGHT="BMI_HEIGHT"; protected void onPause() { super.onPause(); Log.v(TAG, "onPause"); SharedPreferences setting=getSharedPreferences(PREF,0); Editor editor=setting.edit(); editor.putString(PREF_HEIGHT, cmInput.getText().toString()); editor.commit(); } 我問題是..宣告成final不是不能變更的嘛!? 為什麼可以輸入的東西存在裡面? -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 163.25.118.131
kenliner:...他並沒有改變變數的內容 08/24 17:48
ericinttu:Editor putString (String key, String value) 08/24 17:56
ericinttu:key: The name of the preference to modify. 08/24 17:57
ericinttu:value: The new value for the preference. 08/24 17:57
LPH66:有點像是 a[x]=y 我們改的是 a[x] 不是 x 這種感覺 08/24 19:59
ppaass:變數宣告成final只是不能改變它的參考,不是不能呼叫方法. 08/24 22:14
g548462:感謝.. 08/25 16:36