Basicly I have the following structure in my app:
It would be straightforward to implement such a structure without the abstract class ProjectItem
, but in this case I don't know how to implement this.
The abstract class ProjectItem
needs a CREATOR
as it should be parcelable. (like
in.readTypedList(mProjectItems, ProjectItem.CREATOR);
within the constructor Project(Parcel in))
But in fact, the CREATOR
can only be implemented in its derived classes for logical reasons.
So, how to implement this structure in order to keep the class Project
parcelable??
Edit
This is what one of the constructors of Project
looks like:
private Project(Parcel in) {
in.readTypedList(mProjectItems, ProjectItem.CREATOR);
}
But as I already said, ProjectItem
shouldn't have to implement a CREATOR
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…