0
我有一個類如下:如何刪除RealmList元素?
public class SomeStuff extends RealmObject {
public RealmList<CatDetails> cat;
public RealmList<CatDetails> getcat() {
return cat;
}
public void setCat(RealmList<CatDetails> cat) {
this.cat = cat;
}
}
和這裏的CatDetails:
public class CatDetails extends RealmObject {
@Index String catNumber;
@Index String catName;
// setters and getters for catName and catNumber
}
現在我該怎樣去從外地cat
刪除一個元素?也就是說,我想1
,以減少類SomeStuff
ArrayList中的大小我已經試過:
realm.where(SomeStuff.class).findAll().get(pos).getCatDetails().get(0).deleteFromRealm();
還有:
realm.where(SomeStuff.class).findAll().get(pos).getCatDetails().deleteAllFromRealm();
,但我得到的在兩種情況下填充回收站視圖時的ArrayIndexOutOfBoundsException。
那麼你需要添加你在使用RecyclerView適配器所做的事情....無論是RealmRecyclerViewAdapter,更重要的是你在做什麼線程刪除 – EpicPandaForce