Android java : How to copy/move file from assets to absolute path?
private void moveAssets(String assets_file_path, String absolutePath) throws IOException {
File wwwFile = new File(absolutePath);
if (wwwFile.exists())
return;
InputStream is = activity.getAssets().open(assets_file_path);
byte[] buffer = new byte[is.available()];
is.read(buffer);
is.close();
wwwFile.createNewFile();
FileOutputStream os = new FileOutputStream(wwwFile);
os.write(buffer);
os.close();
}
❤️ Support This Blog
If this post helped you, you can support my writing with a small donation. Thank you for reading.
Comments
Post a Comment