List of usage examples for java.io File delete
public boolean delete()
From source file:Main.java
public static boolean deleteSdCardFile(String filePath) { try {/* w w w . j a v a2 s .c o m*/ File file = new File(filePath); return file.delete(); } catch (Exception e) { e.printStackTrace(); return false; } }
From source file:Main.java
public static final boolean deleteFile(String path) { if (storageReady()) { File f = new File(path); return f.delete(); } else {/*from w ww. ja va 2 s . co m*/ return false; } }
From source file:Main.java
/** * * @param file//from ww w .j a v a 2 s . c om * @return */ public static boolean deleteImage(File file) { try { return file.delete(); } catch (Exception e) { return false; } }
From source file:Main.java
public static void delete(File src) { if (src.exists()) { if (!src.delete()) { src.deleteOnExit();/* ww w . j a v a 2s .c o m*/ } } }
From source file:Main.java
public static void removeLoginMember(Context cxt) { File data = cxt.getFileStreamPath(key_login_member); data.delete(); }
From source file:Main.java
public static void delete(String path) { try {/* ww w . j av a2s.c o m*/ if (path == null) { return; } File file = new File(path); if (!file.delete()) { file.deleteOnExit(); } } catch (Exception e) { e.printStackTrace(); } }
From source file:Main.java
/*** * delete all logs/*from ww w . ja v a2 s .c o m*/ */ public static void deleteAllFiles() { File directory = new File(Environment.getExternalStorageDirectory() + File.separator + folderName); if (directory.exists()) { for (File file : directory.listFiles()) file.delete(); } }
From source file:Main.java
public static void deleteIfExists(File file) throws IOException { if (file.exists() && !file.delete()) { throw new IOException(); }// ww w . j av a 2 s . c om }
From source file:Main.java
public static boolean deleteFile(File file) { if (file.exists()) { return file.delete(); } else {/*w w w. j a v a2s . c om*/ return false; } }
From source file:Main.java
/** * Clears any leftover photos in our temporary folder. *//*from w w w . ja v a2 s . co m*/ public static void clearPhotos() { File tempDir = Environment.getExternalStorageDirectory(); tempDir = new File(tempDir.getAbsolutePath() + "/bv-temp/"); if (tempDir.listFiles() != null) { for (File photo : tempDir.listFiles()) { photo.delete(); } } }