Android Text File Write writeStringToFile(File file, String data)

Here you can find the source of writeStringToFile(File file, String data)

Description

write String To File

Declaration

public static void writeStringToFile(File file, String data) 

Method Source Code

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

import java.io.FileWriter;

public class Main {
    public static void writeStringToFile(File file, String data) {
        FileWriter writer = null;
        try {/*from w  w w .j a  v  a  2s  .  c o m*/
            if (file.exists())
                file.delete();
            file.createNewFile();
            writer = new FileWriter(file);
            writer.write(data);
            writer.close();
        } catch (Exception e) {

        }
    }
}

Related

  1. writeStringToFile(String text, String filePath)
  2. writeToSDFile(String directory, String file_name, String text)
  3. writeFileEnd(String filepath, String text)
  4. WriteFile(String file, String message)
  5. writeNewFile(String filePath, String fileContents)
  6. writeTextFile(File file, String str)
  7. writeTextFile(File file, String[] strArray)