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();
    }
 

Subscribe to Post, Code and Quiet Time.

Don’t miss out on the latest issues. Sign up now to get access to the library of members-only issues.
jamie@example.com
Subscribe