Monday, October 10, 2011

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

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 ? getPersistedBoolean(false) : defaultValue.toString().equals("true") ? true : false;
    if (!restoreValue)
        persistBoolean(temp);
    this.oldValue = temp;
    }

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment