Reputation: 150
I have an activity which extends PreferenceActivity and i have a class which extends PreferenceFragment.
After I initiate the switchPreference variable (inside the Fragment) I set OnPreferenceChangeListener to it. The problem is when I do set a listener I cant change the state of the switch button (it remain at the same position). If I disable the statement where Im setting the listener the switch button works fine and also the state is saved.
I also have a wrapper class for the sharedPreferences which I want to save a data into it on switchpreference change.
Did anyone encounter such a weird behavior?
Any help will be appreciate.
Upvotes: 4
Views: 1125
Reputation: 150
Well, I found the the "onPreferenceChange" function returned false and when I changed it to true it worked.
Thanks to all who was looking for answering me.
Upvotes: 4