小编Spa*_*t87的帖子

如何使RealmList可以生成

我需要在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

java android realm

6
推荐指数
1
解决办法
3931
查看次数

标签 统计

android ×1

java ×1

realm ×1