Android Realm - Accessing Realm Object from Service
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a realm object that is created in my activity. I need to be able to access this object within a service that I created. However I'm getting the error when creating the Realm object within the service mRealm = Realm.getInstance(getApplicationContext()); java.lang.IllegalStateException: Realm access from incorrect thread. Realm objects can only be accessed on the thread they were created Now I understand this means that because the realm object was created on my activity, I cannot access it from a background thread. However, I'm not