In many apps you need to store object/data in internal memory (custom Object, collection object: ArrayList, HashMap ecc.. ) in memory. In Android it’s very simple, for example if you want store a object “City”:
/* you should declare private and final FILENAME_CITY */
stream = ctx.openFileOutput(FILENAME_CITY, Context.MODE_PRIVATE);
ObjectOutputStream dout = new ObjectOutputStream(stream);
dout.writeObject(city);
dout.flush();
stream.getFD().sync();
stream.close();
if the file (FILENAME_CITY) doesn’t exist, the system will create the file.

Great, thanks for sharing