0

I am trying to implement a RESET to Default option, part of my settings. What it does is it reverts back to the default value. My issues is when I reset everything how can I also update the EditTextPreference value with the newValue? It updates only after exiting the activity and returning back to it.The preference is correctly updated but not the actual content of the EditTextP. Thank you for your time reading this!

@Override
                public void onClick(DialogInterface dialog, int which) {

                    SharedPreferences preferences = 
                            PreferenceManager.getDefaultSharedPreferences(PreferencesActivity.this); 
                    SharedPreferences.Editor editor = preferences.edit(); 

                    editor.clear();                         
                    editor.commit();

                    PreferenceManager.setDefaultValues(PreferencesActivity.this, R.xml.preferences, true);                      
                    editor.commit();                                                    

                    CheckBoxPreference enableEdit = (CheckBoxPreference)findPreference("IsChecked");    
                    enableEdit.setChecked(false);


                } }); 
braX
  • 11,506
  • 5
  • 20
  • 33
Marquis
  • 185
  • 1
  • 1
  • 11
  • try looking into http://liquidlabs.ca/2011/08/25/update-preference-value-without-reloading-preferenceactivity/ - may be it will solve the issue about refreshing value. – Hossain Khan Feb 20 '13 at 19:36
  • I followed the same logic with minor modifications and it worked. Thanks :). – Marquis Feb 20 '13 at 20:23

0 Answers0