I have the following XML code for my CheckBoxPreference:

 <CheckBoxPreference
        android:key="pref_boot_startup"
        android:title="Auto start"
        android:defaultValue="true"
        />

But when I retrieve the preference in code the value is false.

 sharedPreferences =
PreferenceManager.getDefaultSharedPreferences(this);
 boolean autoStart = sharedPreferences.getBoolean("pref_boot_startup",
true);

My autoStart variable returns false.

Is there a specific reason for this? Am I missing a step to set the
default value to true?

-- 
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