0
我在编辑DefaultSharedPreferences时遇到问题。 注意,我有一个方法,我经常打电话,我想用它的输入来编辑默认的共享首选项。编辑默认共享首选项
这里是我试过,但似乎并没有工作:
mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
SharedPreferences.Editor editor = mSharedPreferences.edit();
editor.putString(getString(R.string.pref_location_default), stringCoordinates);
editor.commit();
这里是我关心的字符串:
<!-- Key name for storing location in SharedPreferences [CHAR LIMIT=NONE] -->
<string name="pref_location_key" translatable="false">location</string>
<!-- Default postal code for location preference [CHAR LIMIT=NONE] -->
<string name="pref_location_default" translatable="false">-34.8799074,174.7565664</string>
有人可以帮我吗?
Thx!
你不应该使用R.string.pref_location_key您editor.putString? – 2014-12-05 04:37:07
Geez ...确实愚蠢的错误! – Makoto 2014-12-05 04:47:57