我需要在Realm模型中实现Parcelable接口,但我不知道如何在包中编写RealmList
这是我的代码:
public class SomeModel extends RealmObject implements Parcelable {
public long id;
public RealmList<SomeOtherModel> otherModels;
protected SomeModel(Parcel in) {
id = in.readLong();
//here i need to otherModel RealmList from parcel
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeLong(id);
// here i need to write the otherModels RealmList
}
//other methods omitted
}
Run Code Online (Sandbox Code Playgroud)
pd:SomeOtherModel类还实现了Parcelable接口并扩展了RealmObject