{"action":"closed","issue":{"url":"https://api.github.com/repos/realm/realm-java/issues/1801","labels_url":"https://api.github.com/repos/realm/realm-java/issues/1801/labels{/name}","comments_url":"https://api.github.com/repos/realm/realm-java/issues/1801/comments","events_url":"https://api.github.com/repos/realm/realm-java/issues/1801/events","html_url":"https://github.com/realm/realm-java/issues/1801","id":117777875,"number":1801,"title":"Unexpected adapter view refresh after onPause()","user":{"login":"changxiangzhong","id":5352145,"avatar_url":"https://avatars.githubusercontent.com/u/5352145?v=3","gravatar_id":"","url":"https://api.github.com/users/changxiangzhong","html_url":"https://github.com/changxiangzhong","followers_url":"https://api.github.com/users/changxiangzhong/followers","following_url":"https://api.github.com/users/changxiangzhong/following{/other_user}","gists_url":"https://api.github.com/users/changxiangzhong/gists{/gist_id}","starred_url":"https://api.github.com/users/changxiangzhong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/changxiangzhong/subscriptions","organizations_url":"https://api.github.com/users/changxiangzhong/orgs","repos_url":"https://api.github.com/users/changxiangzhong/repos","events_url":"https://api.github.com/users/changxiangzhong/events{/privacy}","received_events_url":"https://api.github.com/users/changxiangzhong/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-11-19T09:50:49Z","updated_at":"2015-11-19T09:58:55Z","closed_at":"2015-11-19T09:58:55Z","body":"Hi all,\r\nI'm getting this exception \r\n```java.lang.IllegalStateException: Illegal State: Object is no longer valid to operate on Was it deleted by another thread?\"```. The exception is thrown from a ```Adapter::getGroupCount()``` method. Which doesn't make sense to me is fragment's ```onPause()``` method has already been invoked.\r\n\r\nThe whole sequence is as following: There are 5 steps as following. What's worthy mentioning is in step 2, a server request is made, and in step 4 the server replies a response, and we save the data into the Realm DB, which cause the exception. Again, what I don't understand, is the TaskSentDetailFragment is already in \"onPause\" state. Which its adapter is still being invoked. Is there some way to bypass this \r\n\r\n    ===>: TaskSentDetailFragment::onPause()\r\n    ===>: TaskSentListFragment::onActivityCreated() //Will trigger the communication to Server\r\n    ===>: TaskSentListFragment::onResume()\r\n    ===>: onGetSentTasks // Server has replied, update the Realm DB\r\n    ===>:java.lang.IllegalStateException: Illegal State: Object is no longer valid to operate on. Was it deleted by another thread?"}}