Issue with Sharedpreferences in kitkat version in android

你说的曾经没有我的故事 提交于 2019-12-02 11:45:47

Try this way,hope this will help you to solve your problem.

SharedPreferences sharedPreferences = getSharedPreferences(getString(R.string.app_name), MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putBoolean("Passcode", Globals.str_Passcode);
editor.commit();

sharedPreferences.getBoolean("Passcode",false);

I had a similar problem. It was this missing from MainActivity,

prefs = PreferenceManager.getDefaultSharedPreferences(this);
    PreferenceManager.setDefaultValues(this, R.xml.prefs, false);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!