Java tutorial
//package com.java2s; import android.os.Environment; import java.io.FileWriter; public class Main { public static String mFilePath = Environment.getExternalStorageDirectory() + "/IMEI.txt"; public static void writeFile(String writr_str, boolean add) { try { FileWriter fout = new FileWriter(mFilePath, add); fout.write(writr_str); if (add) { fout.write("\r\n"); } else { } fout.close(); } catch (Exception e) { e.printStackTrace(); } } }