Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><strong>Delete</strong></p> <pre><code>public static void deleteRecursive(File fileOrDirectory) { if (fileOrDirectory.isDirectory()) for (File child : fileOrDirectory.listFiles()) deleteRecursive(child); fileOrDirectory.delete(); } </code></pre> <p>check <a href="https://stackoverflow.com/questions/4943629/android-how-to-delete-a-whole-folder-and-content">this</a> link for above function.</p> <p><strong>Copy</strong></p> <pre><code>public static void copyDirectoryOneLocationToAnotherLocation(File sourceLocation, File targetLocation) throws IOException { if (sourceLocation.isDirectory()) { if (!targetLocation.exists()) { targetLocation.mkdir(); } String[] children = sourceLocation.list(); for (int i = 0; i &lt; sourceLocation.listFiles().length; i++) { copyDirectoryOneLocationToAnotherLocation(new File(sourceLocation, children[i]), new File(targetLocation, children[i])); } } else { InputStream in = new FileInputStream(sourceLocation); OutputStream out = new FileOutputStream(targetLocation); // Copy the bits from instream to outstream byte[] buf = new byte[1024]; int len; while ((len = in.read(buf)) &gt; 0) { out.write(buf, 0, len); } in.close(); out.close(); } } </code></pre> <p><strong>Move</strong></p> <p>move is nothing just <strong>copy the folder one location to another</strong> then <strong>delete the folder</strong> thats it</p> <p><strong>manifest</strong></p> <pre><code> &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload