SharedPreferences 存储

发布于 2018-06-03  10 次阅读


写入

SharedPreferences.Editor editor = getSharedPreferences("GameData",
                MODE_WORLD_WRITEABLE).edit();
        editor.putString(payCode, payCode);
        editor.commit();

读取

 SharedPreferences read = getSharedPreferences("GameData",
                MODE_WORLD_READABLE);
        String value = read.getString(payCode, "");