Sunday 15 January 2012

sdk - Exporting of Android project - how to add a folder to .apk which will be installed too -



sdk - Exporting of Android project - how to add a folder to .apk which will be installed too -

(i writing in java , using libgdx framework, , using eclipse) so, using images in assets folder, not exists, because if export project .jar not create assets folder, images loaded in game, good(the .jar file includes assets folder). but, problem, creating highscore saving, so, if trying create file: highscore.bin assets(game exported , running) not save there, highscore not saved anywhere, saving not work. tried export .jar , created folder creating file , updating file(c://pc//folder//highscore.bin. , set destination of saving highscore : c://pc//folder//highscore.bin , works! on android, cant add together folder mobile every mobile individually. question is, how create .apk file(which installs game) install game, , folder? if exporting .apk there not function lets me this.

thank in advance

you cannot create files in apk. apk , jar archives , contain different info including classes , assets (you can seek open jar or apk file archiver winzip). games using device file scheme store game resources , save files. code:

//read filehandle file = gdx.files.internal("savefile/highscore.txt"); if(file.exists()){ highscore = float.valueof(file.readstring()); } //write if(currentscore > highscore){ file.writestring(float.tostring(currentscore ),false); }

but in cases preferences improve suited store little numbers or strings in memory. nice tutorial here: https://github.com/libgdx/libgdx/wiki/preferences

android sdk libgdx export apk

No comments:

Post a Comment