Android Serialization for saving the data...
i have three classes and want to store all the data of three classes... these classes are composed in main class ... so can any one tell that whether i have imple开发者_Python百科ment the Serilzable interface on class or all three classes which are composed....
please check this out http://developer.android.com/guide/topics/data/data-storage.html it is according to your requirement. but i suggest to use the shared preference if the data is in key pair value.it store value in xml tag inside the application and also fast operation as compare to other thing. for shared preference here
All objects in the object tree of a Serializable
object must implement Serializable
; otherwise you'll get a NotSerializableException
.
Serialization is for entire object graph or none. For e.g you have the following scenario
Class A
{
class b = new class B();
class c = new class C();
class d = new class D();
}
Suppose if you want to serialize A then all of the composed objects of different class has to implement serializable including A if any of composed object fails to implement serializable then NoSerializableException will be thrown.
精彩评论