假设您在某个库(LibClass)中有一些可序列化的类
你有自己的班级
class Foo implements Parcelable {
private List<LibClass> mLibraryList;
public static final Parcelable.Creator<Foo > CREATOR
= new Parcelable.Creator<Foo >() {
public Foo createFromParcel(Parcel in) {
return new Foo (in);
}
public Foo [] newArray(int size) {
return new Foo [size];
}
};
}
问题是 - 如何从 Parcel 创建一个构造函数?
private Foo(Parcel in) {
in.readList(mLibraryList, ???); // whoaps! where is the loader for lib class?
}