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 constructor is called.

I was suspecting the xml, but I don't see any problem in it
(android:defaultValue is set and android:persistent as well):

    <com.tlegras.tools.SeekBarPreference
        android:key="preferences_epg_daytostore"
        android:title="@string/preferences_epg_daytostore_title"
        android:summary="@string/preferences_epg_daytostore_summary"
        android:dialogMessage="Nombre de journées à télécharger.
Attention, plus ce nombre est élevé, plus le chargement sera long et moins
l'application sera réactive."
        android:text=" jour(s)"
        android:defaultValue="4"
        android:max="5"
        android:persistent="true"
        />


2011/10/11 lbendlin <l...@bendlin.us>

> 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+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en




-- 
Thierry.

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to