Closed ghost closed 8 years ago
Hi @ramanbranavitski
That is an expected error as your RealmResults is created on the Schedulers.io()
thread and then accessed on the UI thread. It is also described here: https://github.com/realm/realm-java/blob/master/examples/rxJavaExample/src/main/java/io/realm/examples/rxjava/gotchas/GotchasActivity.java#L94-Lundefined
I was just going over documentation, and it could be better explained there, so we will fix that.
Hi @cmelchior , I call
.map(new Func1<RealmObject, T>() {
@Override
public T call(RealmObject realmObject) {
Log.d("TEST", Thread.currentThread().getName());
return (T) mRealm.copyFromRealm(realmObject);
}
})
According to documentation Realm.copyFromRealm() which makes it possible to copy Realm data into normal Java objects, effectively detaching them from Realm.
And this also perform on Schedulers.io()
.
This exception is throw by your `addChangeListener
method
if (realm.handler == null) {
throw new IllegalStateException("You can't register a listener from a non-Looper thread ");
}
I tried to add RealmObject item to Realm and wrap this operation into Observable. This is my code
And use this as
Tried all available schedulers.
When I try to run it I receive IllegalStateException: You can't register a listener from a non-Looper thread .