Android examples for File Input Output:Object Serialization
load Object From File
//package com.java2s; import java.io.FileInputStream; import java.io.IOException; import java.io.ObjectInputStream; import android.app.Activity; import android.util.Log; public class Main { public static Object loadObjectFromFile(Activity owner, String filename) { Object result = null;/* w w w . j a v a 2 s . c o m*/ try { FileInputStream fis = owner.openFileInput(filename); ObjectInputStream objIn = new ObjectInputStream(fis); result = objIn.readObject(); objIn.close(); fis.close(); } catch (ClassNotFoundException e) { Log.i(owner.getClass().getSimpleName(), "Input file could not be found."); } catch (IOException e) { Log.i(owner.getClass().getSimpleName(), "Error reading input file " + filename + "."); } return result; } }