Java tutorial
//package com.java2s; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.util.Properties; import android.content.Context; public class Main { private static final String FILE_ENCODING = "utf-8"; /** * (android) write to file * * @param fileName * @param toSave * @return */ public static boolean androidFileSave(Context con, String fileName, String toSave) { Properties properties = new Properties(); properties.put(FILE_ENCODING, toSave); try { FileOutputStream stream = con.openFileOutput(fileName, Context.MODE_WORLD_WRITEABLE); properties.store(stream, ""); } catch (FileNotFoundException e) { return false; } catch (IOException e) { return false; } return true; } }