Juhani
Juhani

Reputation: 5108

IllegalStateException for RealmObject after copyFromRealm

I'm getting this exception:

java.lang.IllegalStateException: This Realm instance has already been closed, making it unusable.

when calling an accessor of an object even after the object has been detached from Realm with realm.copyFromRealm().

My understanding of the Realm documentation was that once I copy the object from Realm it no longer run the state validations or require open realm connection.

Any ideas what could be the cause?

Upvotes: 0

Views: 218

Answers (1)

Craig Russell
Craig Russell

Reputation: 3584

It is hard to say without seeing some code, but are you sure you are accessing the object returned from copyFromRealm and you are not still accessing the original object?

Upvotes: 1

Related Questions