Note that there are some explanatory texts on larger screens.

plurals
  1. POPreferenceActivity Refresh Problem
    text
    copied!<p>I have PreferemceActivity inflated from xml:</p> <pre><code>&lt;PreferenceScreen android:title="Appearence" android:key="AppearencePref" &gt; ...... &lt;PreferenceCategory android:title="Show Contact Photos"&gt; &lt;CheckBoxPreference android:title="Show Contact Photos" android:summary="@string/show_contact_photos_preference" android:defaultValue="true" android:key="ShowContactPhotosCheckBoxPref_Appendix" /&gt; &lt;/PreferenceCategory&gt; ........ &lt;/PreferenceScreen&gt; ....... &lt;PreferenceScreen android:title="Contact Options" android:key="ContactOtionsPref"&gt; &lt;PreferenceCategory android:title="Show Contact Photos"&gt; &lt;CheckBoxPreference android:title="Show Contact Photos" android:defaultValue="true" android:key="ShowContactPhotosCheckBoxPref" /&gt; &lt;/PreferenceCategory&gt; ...... &lt;/PreferenceScreen&gt; </code></pre> <p>One of the preferences(checkbox) change state of other checkbox:</p> <pre><code>if("ShowContactPhotosCheckBoxPref_Appendix".equals(key)){ SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(mContext); boolean isChecked = prefs.getBoolean("ShowContactPhotosCheckBoxPref_Appendix", false); Editor editor = PreferenceManager.getDefaultSharedPreferences(mContext).edit(); editor.putBoolean("ShowContactPhotosCheckBoxPref", isChecked); editor.commit(); } </code></pre> <p>But when I go to screen with ShowContactPhotosCheckBoxPref it still hold previous preference value... So if I click on ShowContactPhotosCheckBoxPref_Appendix - his state is now unchecked and then go to screen with ShowContactPhotosCheckBoxPref - his state still checked, but value in SharedPreferences is false...</p> <p>How can I tell PreferenceActivity to refresh its value?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload