Juhani Juhani - 2 years ago 337
Android Question

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

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?

Answer Source

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?

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download