I loaded an image from the web and saved it as an image file using ImageIO.read(), ImageIO.write() methods. This file is saved on the default location based on the platform in which the application is running (for Android it is under main root ‘/’). Now I need to move this file into the resources directory so that I can load the image using assets().getImage() method.
But i have not found any way to do this.
Is there way to save file(any format) under resource directory at runtime in playN?????….
No, not in a platform independent or portable way, it may be possible during development or on particular platforms.
The resource directory is often embedded in a read-only jar archive or the platform equivalent of that. Generally speaking the resources is read-only so there is no platform independent way to write to that folder.
The java platform has the resources embedded in a jar file and to the best of my knowledge it is not easy to dynamically add to a jar while at the same the reading it.
The HTML platform typically lives on a web server and most web servers do not by default allow you to write to any folder. With appropriate config this can probably be bypassed, but again it will not be easy.