Working on a project for caching. Would like to do it with file system on Android.
I know database is also a option but want to give try to file systems.
Making a object serializable in case of Android its very easy to use the ObjectOutputStream and ObjectInputStream to serialize and deserialize entrire arraylist of objects happens automatically.
It also allows passing of objects between two activities. However the load time of my application has increased by a ratio of 5 when reading a 250 node list.
I know parcelable also does the passing part and is Android’s way for serialization. However, anyone has ideas how to use parcelable along with ObjectOutputStream so that full utilization of the Android’s serialization can be used.
Also if anyone has ideas how to speed up serialization apart for readObject and writeObject please share. And by doing this how much of a difference can be achieved and is it advisable to do so.
Or is the database way the only option for caching in case of android. Not to forget pre-caching can also be achieved via db but we can?
Don’t use parcels. Per the Android Documentation ( http://developer.android.com/reference/android/os/Parcel.html) :
Making an object implement the serializable interface is risky too because then you’re tied to that serialization format. If you change the object in the future, you’re going to have issues reading in objects that were serialized under the old regime.
Using a database is probably your best option for caching things to disk.