I have a settings class that extends PreferenceActivity. I have a checkbox preference in the corresponding preferences.xml. The default value is false. But, I set it to true during a run and whenever the application launches, the value is set to true. I need it to take the default value which is false each time the application launches. Shouldn’t that be the default behaviour?
I have a settings class that extends PreferenceActivity. I have a checkbox preference in
Share
As per comments on the OP:
PreferencesActivitysaves each item in the preferences for use later in the app. These values are also retained after exit. A “default” value only shows up if the preference has not been set before, which means your value will only befalseuntil someone sets it totrue. They can later change it back tofalse, but it will never again use the default value.To reset to the default value, the application must be uninstalled and reinstalled (or have its data cleared via Application Manager).