Java tutorial
//package com.java2s; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import android.content.Context; public class Main { public static void CacheString(String data, String filename, Context ctx) { try { FileOutputStream fos = ctx.openFileOutput(filename, Context.MODE_PRIVATE); fos.write(data.getBytes()); fos.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } }