Search code examples
androidpreference

Cannot load default values from custom preference


I used Mark Murphy's code to built a custom preference, a TimePreference with a TimePicker in particular. I have a problem with getting and storing the default values in onSetInitialValue method, where null is returned. I also read that PreferenceManager.setDefaultValues(this, R.xml.preferences, false); does not work with strings, which in fact does not work in my case. Is there a way to get and set the default values without using the PreferenceManager's getDefaultSharedPreferences method?


Solution

  • I deleted the preference file from the emulator and everything is back to normal