Java tutorial
//package com.java2s; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStreamWriter; import android.util.Log; public class Main { public static void writeToFile(String path, String data) { try { OutputStreamWriter outputStreamWriter = new OutputStreamWriter(new FileOutputStream(path)); outputStreamWriter.write(data); outputStreamWriter.close(); } catch (IOException e) { Log.e("Exception", "File write failed: " + e.toString()); } } }