Libgdx Android not reading textures

Hey, I want to save an image to the Libgdx’s internal storage then read the image in another menu of my game. This works on my desktop but not on my Android device.

This is the code to save an image:

FileHandle fh = Gdx.files.local("out/" + name + ".png");
if(fh.exists()) return;
Pixmap pixmap = getScreenshot();
PixmapIO.writePNG(fh, pixmap);

And to get all of the images in the “out” directory, then add them to a Texture ArrayList:

FileHandle checks = Gdx.files.internal("out");
for(int i = 0; i < checks.list().length; i++) {
   	String path = "out/"+checks.list()[i].name();
	Texture texture = new Texture(Gdx.files.internal(path));

I’m sure I’m doing something wrong.

Thanks a bunch.

I’m not quite sure about this but it might be that you cannot save to that place where Libgdx stores your assets, because it is inside your apk file. Use Context.getFilesDir() method to get a place to store you files.

How can I get the Context (AndroidLauncher) to the core project?

Using Gdx.files.external works, but I don’t want the user to be able to access the images via a file browser.