Realm access from incorrect thread

后端 未结 4 2076
青春惊慌失措
青春惊慌失措 2020-12-06 09:35

I have an application with a LoginActivity, that when the user login correctly, I register to receive messages. And the LoginActivity jumps to

4条回答
  •  时光说笑
    2020-12-06 10:28

    I haven't use Realm yet. But what i understood from the error message is that ConnectionConnectResponse may be alive when Loginactivity die. So you should pass Realm instance as a parameter inside

    newMessageReceived(Realm realm, final ChatMessage message)

    and put all the Realm init code in the class where you fire this method.

提交回复
热议问题