I have a class that implements a Parcelable, but it had only primitive types as members.
Until now, I passed an instance of this class as a Parcelable without problem between two activities.
But I'm adding a member which type is a Period (java.time).
Doing my research on internet I found that passing a member object (not parcelable) of a class that implements a parcelable, I should pass actually the fields of this object (primitive types or String) through the parcelable and not the whole object (since it's not implementing the parcelable)
Looking at the documentation, the Period class doesn't implement Parcelable.
So, would be this the right way to pass it through a Parcelable?
Period objPeriod;
public void writeToParcel(Parcel out, int flags){
out.writeString(objPeriod.toString());
}
private MyClass(Parcel in){
objParcel.parse(in.readString());
}