Realm `access from incorrect thread` error when using shared code between IntentService and AsyncTask (Android)

前端 未结 3 1674
北海茫月
北海茫月 2020-12-31 03:17

I have some code that downloads a \"Current\" object\'s JSON. But this same code needs to be called by an IntentService whenever an alarm goes off (when the app is not runni

3条回答
  •  无人及你
    2020-12-31 03:52

    The problem is you are calling methods from differents threads, you have to use the same thread, create your own HandlerThread.

提交回复
热议问题