Java tutorial
//package com.java2s; import java.io.FileOutputStream; import java.io.IOException; public class Main { public static void writeFileSdcard(String fileName, String message, boolean append) { FileOutputStream fout = null; try { fout = new FileOutputStream(fileName, append); byte[] bytes = message.getBytes(); fout.write(bytes); } catch (Exception e) { e.printStackTrace(); } finally { if (fout != null) { try { fout.close(); } catch (IOException e) { e.printStackTrace(); } } } } }