Android examples for File Input Output:File Exist
create New File for append
//package com.book2s; import java.io.File; public class Main { public static File createNewFile(String path, boolean append) { File newFile = new File(path); if (!append) { if (newFile.exists()) { newFile.delete();//from ww w .j ava2 s .c o m } } if (!newFile.exists()) { try { File parent = newFile.getParentFile(); if (parent != null && !parent.exists()) { parent.mkdirs(); } newFile.createNewFile(); } catch (Exception e) { e.printStackTrace(); } } return newFile; } }