Java tutorial
//package com.java2s; import java.io.FileOutputStream; import android.app.Activity; import android.widget.Toast; public class Main { final static String FILENAME = "last_activity.txt"; public static void saveCurrActivity(Activity activity) { saveActivity(activity, activity.getClass()); } private static void saveActivity(Activity activity, Class<? extends Activity> clazz) { FileOutputStream fos = null; try { fos = activity.openFileOutput(FILENAME, Activity.MODE_PRIVATE); fos.write(clazz.getName().getBytes()); } catch (Exception e) { Toast.makeText(activity, "saveActivity: " + e, Toast.LENGTH_LONG).show(); } finally { if (null != fos) try { fos.close(); } catch (Exception e) { } } } }