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);
pixmap.dispose();
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));
textures.add(texture);
filenames.add(checks.list()[i].name());
}
I’m sure I’m doing something wrong.
Thanks a bunch.