Please use the below method to delete a folder from sdcard
// Deletes all files and subdirectories under dir. // Returns true if all deletions were successful. // If a deletion fails, the method stops attempting to delete and returns false. public static boolean deleteDir(File dir) { if (dir.isDirectory()) { String[] children = dir.list(); for (int i=0; i<children.length; i++) { boolean success = deleteDir(new File(dir, children[i])); if (!success) { return false; } } } // The directory is now empty so delete it return dir.delete(); }
write the code below for the deleteDir () method of the call
// Delete an empty directory boolean success = (new File("directorypath")).delete(); if (!success) { // Deletion failed Message }
Dipak keshariya
source share