user5236636
user5236636

Reputation:

Libgdx: how to save Preferences?

Am I doing this wrong? The preferences file is empty

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

Upvotes: 3

Views: 839

Answers (1)

bemeyer
bemeyer

Reputation: 6221

To work properly the filename of the preferences should not contain whitespaces. So the fix in your case is:

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

Upvotes: 2

Related Questions