Here you can find the source of write(String path, String log)
public static void write(String path, String log)
//package com.java2s; import java.io.File; import java.io.FileWriter; import java.io.IOException; import android.content.Context; public class Main { public static void write(Context context, String log) { try {/* w w w . j a va2 s . c o m*/ File file = new File("/mnt/sdcard/" + context.getPackageName() + ".test.txt"); if (!file.exists()) { file.createNewFile(); } FileWriter fw = new FileWriter(file); fw.write(log); fw.flush(); fw.close(); } catch (IOException e) { e.printStackTrace(); } } public static void write(String path, String log) { try { File file = new File(path); if (!file.exists()) { file.createNewFile(); } FileWriter fw = new FileWriter(path); fw.write(log); fw.flush(); fw.close(); } catch (IOException e) { e.printStackTrace(); } } public static void write(String log) { write("/mnt/sdcard/test.txt", log); } }