Triceratops
Triceratops

Reputation: 643

SharedPreferences not saving

Any changes in the SharedPreferences of my application are not reflected until I restart the application. Specifically, I am using a ListPreference, depending on the item selected, the answer is changed (its a type of calculator). The changes are not made until I close and start the application again. Any suggestions?

Upvotes: 0

Views: 101

Answers (2)

Flynn81
Flynn81

Reputation: 4178

Make sure when you use the Editor class you call Editor.commit() after you make your changes.

Upvotes: 1

Guillaume
Guillaume

Reputation: 10971

As you didn't posted any code, it's a shoot in the dark... but if you want preferences to update things in your application, you have to listen to changes on preferences. Otherwise, only the preferences UI is updated.

See the guide on listening for changes for more details.

Upvotes: 0

Related Questions