Android examples for java.io:File Delete
delete File, return true if successful
import java.io.File; public class Main { public static boolean deleteFile(File file) { try {//from w ww. j a v a2 s . c o m if (file == null) { return true; } if (file.isDirectory()) { File[] files = file.listFiles(); for (int i = 0; i < files.length; i++) { deleteFile(files[i]); } } else { file.delete(); } } catch (Exception e) { e.printStackTrace(); return false; } return true; } }