这个问题在这里已经有了答案:Usingsharedpreferenceseditor(3个答案)关闭9年前。我是Android开发的新手-使用一本名为Sams在24小时内自学Android应用程序开发的书。到目前为止一直在关注它,但在尝试使用SharedPreferences时遇到了困难。在src/com.androidbook.triviaquiz文件夹中,我有一个名为QuizActivity的文件,其中包含以下内容:packagecom.androidbook.triviaquiz;importandroid.app.Activity;importandroid.os.Bundle
根据以下代码,您能告诉我如何刷新PreferenceActivity窗口以立即显示设置的更改吗?例如:用户点击主编钟切换复选框为真(勾选),我希望用户立即看到其他设置,如ChimeOn15Past复选框也为真(勾选)SharedPreferences.EditorprefEditor=clockSettings.edit();//Allowthesettingstobechanged.if(booleanMasterChimeToggle==true){prefEditor.putBoolean("ChimeOnTheHour",true);prefEditor.putBoolean(
根据以下代码,您能告诉我如何刷新PreferenceActivity窗口以立即显示设置的更改吗?例如:用户点击主编钟切换复选框为真(勾选),我希望用户立即看到其他设置,如ChimeOn15Past复选框也为真(勾选)SharedPreferences.EditorprefEditor=clockSettings.edit();//Allowthesettingstobechanged.if(booleanMasterChimeToggle==true){prefEditor.putBoolean("ChimeOnTheHour",true);prefEditor.putBoolean(