Re: [android-developers] Re: Custom DialogPreference and PreferenceManager.setDefaultValues issue

2013-10-25 Thread mattcoz
I had the same problem and fixed it by persisting the value in the onSetInitialValue method. The javadoc says: If restorePersistedValue is false, you should set the Preference value to defaultValue that is given (and possibly store to SharedPreferences if

Re: [android-developers] Re: Custom DialogPreference and PreferenceManager.setDefaultValues issue

2012-09-23 Thread Gene Wildhart
Your solution works perfectly for me on Gingerbread (Android 2.3.7) and below. However, when trying on ICS (4.0+) or newer, neither the * onSetInitialValue* or the *onGetDefaultValue* functions are ever called. Can anyone explain why the behavior changed in ICS? On Friday, July 27, 2012

Re: [android-developers] Re: Custom DialogPreference and PreferenceManager.setDefaultValues issue

2012-07-27 Thread jdr88
Finally, I've found a solution to this problem! The official documentation for the preferences activity has just been updated. Check out the paragraph about Building a Custom Preference http://developer.android.com/guide/topics/ui/settings.html#Custom You have to implemenet both of the

Re: [android-developers] Re: Custom DialogPreference and PreferenceManager.setDefaultValues issue

2012-07-15 Thread jdr88
I just came across the same issue and can confirm the same behaviour: *android:defaultValue* of a custom DialogPreference is *not* set with PreferenceManager.setDefaultValues() method. Seems like a bug? I'm using now the solution that you proposed... On Thursday, 13 October 2011 23:11:27

Re: [android-developers] Re: Custom DialogPreference and PreferenceManager.setDefaultValues issue

2011-10-13 Thread Thierry Legras
Okay, I give up. My preference default value will be copied in the preference access code as well: value = sharedPref.getInt(mykey,myDirtyHardcodedDefaultValue ); If ever someone has a better solution, it will be welcome :) Thierry. 2011/10/11 Thierry Legras tleg...@gmail.com Hi Ibendlin,

Re: [android-developers] Re: Custom DialogPreference and PreferenceManager.setDefaultValues issue

2011-10-11 Thread Thierry Legras
Hi Ibendlin, Thanks for helping me :) I don't think the problem is in SeekBarPreference.onSetInitialValue() function itself as it is never called (I have put a log in it to check). There is certainly an issue somewhere in my implementation; when setDefaultValues is called, only SeekBarPreference

[android-developers] Re: Custom DialogPreference and PreferenceManager.setDefaultValues issue

2011-10-10 Thread lbendlin
it took me a few weeks to get that right. here's my example for a boolean value. And yes, .setDefaultValues is actually working, despite what you may think :-/ @Override protected void onSetInitialValue(boolean restoreValue, Object defaultValue) { boolean temp = restoreValue ?