Reputation: 1606
I have RealmList in the RealmObject and some other RealmObjects. I want to clear list and remove objects from RealM BUT if some other object has reference on this object(that is in the RealmList) I want just clear references and keep it in RealM.
I didn't find method for such deleting, is there any easy way?
Upvotes: 1
Views: 1487
Reputation: 20126
RealmList has two methods for removing objects from it:
RealmList.remove(index)/RealmList.clear()
removes items only from the list, but doesn't delete them from the Realm.RealmList.deleteFromRealm()/RealmList.deleteAllFromRealm()
removes items from both the list and Realm.So, if you just use remove()/clear()
it should work the way you want. You see the methods in our API docs here: https://realm.io/docs/java/latest/api/io/realm/RealmList.html
Upvotes: 3