n call <code><a href="../../../reference/android/content/SharedPreferences.Editor.html#commit()">commit()</a></code> to save the changes. For example:</p>

<pre>
SharedPreferences sharedPref = getActivity().getPreferences(Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPref.edit();
editor.putInt(getString(R.string.saved_high_score), newHighScore);
editor.commit();
</pre>


<h2 id="ReadSharedPreference">Read from Shared Preferences</h2>

<p>To retrieve values from a shared preferences file, ca