Android File Delete deleteFile(File f)

Here you can find the source of deleteFile(File f)

Description

delete File

Declaration

public static boolean deleteFile(File f) 

Method Source Code

//package com.java2s;
import java.io.File;

public class Main {
    public static boolean deleteFile(File f) {
        if (f.exists()) {
            if (f.isFile())
                return f.delete();
            else if (f.isDirectory()) {
                File[] files = f.listFiles();
                for (int i = 0; i < files.length; i++) {
                    if (!deleteFile(files[i]))
                        return false;
                }//  w  ww.j a  v  a  2  s . c om
                return f.delete();
            } else
                return false;
        } else
            return false;
    }
}

Related

  1. deleteDatabaseFile(int type, Context context)
  2. deleteDir(File dir)
  3. deleteDir(File dir)
  4. deleteDir(File spec)
  5. deleteDirContent(File d)
  6. deleteFile(File f)
  7. deleteFile(File f)
  8. deleteFile(File file)
  9. deleteFile(File file)