Android File Create createFile(String path)

Here you can find the source of createFile(String path)

Description

create File

Declaration

public static boolean createFile(String path) 

Method Source Code

//package com.java2s;

import java.io.File;

public class Main {
    public static boolean createFile(String path) {
        File file = new File(path);

        try {//from ww w.  j  a  va2  s .  c  o  m
            if (file.exists()) {
                if (file.delete()) {
                    file.createNewFile();
                }
            } else {
                file.createNewFile();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }

        return file.exists();
    }
}

Related

  1. createFile(String file, String content, String encodType)
  2. createFile(String fileName)
  3. createFile(String fileName)
  4. createFile(String filePathAndName, String fileContent)
  5. createFile(String path)
  6. createFile(String path, List content)
  7. createFile(String path, String content)
  8. createFile(String path, boolean isFile)
  9. createFileInFolder(File folder, String fileName)