Tuesday, 15 April 2014

java - SharedPreferences not saving boolean -


On my Galaxy Note 3, I'm having a strange problem with shared preferences, the "saved_name" preference is working fine , Though when I try to save the boolean which does not save it. Actually the log reads: First: After the truth: False makes no sense to it completely.

  Last shared reference prefs = PreferenceManager.getDefaultSharedPreferences (MainActivity.This); // Get the primary sharing preferences. Editor Editor = prefs.edit (); Auto_login_checkbox.setOnCheckedChangeListener (New Compound Button. Check Chainlaster () {@ Changed in face (Compound Button Button View, Boolean Check) {Log.e ("Login", "Before:" + Checked) ; Editor.PoolBoline ("saved logline", is checked); editor.committ (); boolean is_saved = prefs.getBoolean ("saved_login", false); // Why is this printed right if top is correct? E ("saved", "after:" + + isassaid);}}); String name = prefs.getString ("saved_name", tap); // Get a string if (name! = Null) {usernameField.setText (name); }  

Removing location from "saved_login" in putBoolean like this:

Editor. InputBoline ("saved_ login", to check);

No comments:

Post a Comment