Libgdx:如何保存偏好?

时间:2015-08-28 16:58:57

标签: android libgdx preferences

我这样做错了吗? 首选项文件为空

Preferences prefs = Gdx.app.getPreferences("My Preferences");
    prefs.putBoolean("debug",true);
    prefs.flush();

1 个答案:

答案 0 :(得分:3)

要正常工作,首选项的文件名不应包含空格。因此,您的案例中的修复是:

Preferences prefs = Gdx.app.getPreferences("MyPreferences");
    prefs.putBoolean("debug",true);
    prefs.flush();
相关问题