[LibGDX]Correct location to save and load levels

Hello,
I am currently working on a 2D sidescroller. My levels are stored in zip files containing the level data and the texture data, so that a user created level is only 1 file and not a whole folder, that contains all level files.My levels are currently stored in the assets folder. It’s working really when I define the absolute zip file path, but when using the libgdx filehandle, it gives this error:


java.io.FileNotFoundException: maps\test.zip (System cannot find the specified path.)      <- translated, my eclipse is in German

The zipfile is constructed like this:


        File file = Gdx.files.internal("maps/test.zip").file();
        ZipFile archive = null;
	try {
			archive = new ZipFile(file);
	} catch (ZipException e) {		
		e.printStackTrace();
	} catch (IOException e) {		
		e.printStackTrace();
        }

I think it is because the assets are in the apk/jar file and thereforce it can’t load: “maps/test.zip”, because it load’s files relative to the apk.
So, my solution would be creating a levels folder next to the apk/jar and putting the levels into there.( Loading them wouldn’t be a problem anymore then.)

  • My first question is: How can I put files there, because when I use the regular usb debugging, it only sends the apk contaning the assets folder and not some extenal folders.
  • My second question is: Do I have read and write acces to next to my apk?(I sure will need permissions on android for that)
  • My third question is: Can I load the standard levels out of the apk somehow and download the user created levels next to the apk/jar?
  • My fourth question is: Do you think this is a good way to handle levels, or how would you do it?

Sorry if I made some mistakes, English isn’t my mother tongue.I will appreciate help a lot :slight_smile:
-Quex