Android - LIBGDX FileHandle doesn't write to local file -
in game, there highscore supposed saved.
private void savehighscore() { filehandle file = gdx.files.local("asdwdasfwad/asdawwafs.txt"); string highscorestring = integer.tostring(this.highscore); file.writestring(highscorestring, false); gdx.app.log("saving", "saving"); } private int loadhighscore() { filehandle file = gdx.files.local("asdwdasfwad/asdawwafs.txt"); string highscorestring = file.readstring(); int highscore = integer.parseint(highscorestring); gdx.app.log("loading", "loading"); return highscore; } when run on phone, "saving" logged console without errors, though path have specified (asdwdasfwad/asdawwafs.txt) doesn't exist. if use existent path, no file created.
not direct answer problem, since want save highscore:
you can use preferences this. class provided libgdx allows save small data.
for further information visit official documentation page: click here
Comments
Post a Comment