Search code examples
androidrealm

How to change child's parent in Realm


I have one stupid question. How can I change parent of the child in realm java-android with saving child's id. Should I get Bookmark from one parent. delete it. And create new one with the same id in other parent?

Thank you!

UPDATED

Or, if I understand correctly, I can delete from one parent's resultList child and add it to other's without creating a new one.


Solution

  • According to realm's documentation we can freely manipulate RealmList relations contents.

    I've done in the following way:

    new_category.getBookmarks().add(bookmark);
    parent_category.getBookmarks().remove(bookmark);