{"action":"created","issue":{"url":"https://api.github.com/repos/excilys/androidannotations/issues/1504","labels_url":"https://api.github.com/repos/excilys/androidannotations/issues/1504/labels{/name}","comments_url":"https://api.github.com/repos/excilys/androidannotations/issues/1504/comments","events_url":"https://api.github.com/repos/excilys/androidannotations/issues/1504/events","html_url":"https://github.com/excilys/androidannotations/issues/1504","id":97613770,"number":1504,"title":"@UiThread annotation doesn't seem to run code on the ui thread","user":{"login":"smac89","id":8305511,"avatar_url":"https://avatars.githubusercontent.com/u/8305511?v=3","gravatar_id":"","url":"https://api.github.com/users/smac89","html_url":"https://github.com/smac89","followers_url":"https://api.github.com/users/smac89/followers","following_url":"https://api.github.com/users/smac89/following{/other_user}","gists_url":"https://api.github.com/users/smac89/gists{/gist_id}","starred_url":"https://api.github.com/users/smac89/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smac89/subscriptions","organizations_url":"https://api.github.com/users/smac89/orgs","repos_url":"https://api.github.com/users/smac89/repos","events_url":"https://api.github.com/users/smac89/events{/privacy}","received_events_url":"https://api.github.com/users/smac89/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-07-28T04:42:09Z","updated_at":"2015-07-28T13:02:53Z","closed_at":"2015-07-28T13:02:53Z","body":"I have the following code:\r\n```java\r\n\r\nprivate void downloadData() {\r\n    DownloadListener listener = new DownloadListener() {\r\n        @Override\r\n        @UiThread\r\n        public void onContentReceived(long size) {\r\n            Log.d(TAG, \"Is on UI thread: \" +\r\n                    (Looper.getMainLooper().getThread() == Thread.currentThread()));\r\n            infoDialog.setMaxProgress((int) size);\r\n            infoDialog.setContent(R.string.please_wait);\r\n        }\r\n    };\r\n\r\n    Call call = new OkHttpClient().newCall(...);\r\n    call.enqueue(new Customcallback(listener) {\r\n        private DownloadListener listener;\r\n        public Customcallback(DownloadListener l) { listener = l; }\r\n        @Override public void onFailure(Request r, IOException e) {}\r\n        @Override public void onResponse(Request r) throws IOException{\r\n            ...\r\n            listener.onContentRecieved(...);\r\n        }\r\n    });\r\n}\r\n```\r\n\r\nWhenever this code is ran, it always crashes and the log output indicates that it is actually not being run on the ui thread. I'm not sure if this is a bug or I might be missing something about the way this annotation should be used.\r\n\r\nI tried looking at the generated code for this class and it doesn't seem to me that any code is being generated (which might explain the error)\r\n\r\nI also made sure I was using ```org.androidannotations.annotations.UiThread``` not ```android.support.annotation.UiThread```\r\n"},"comment":{"url":"https://api.github.com/repos/excilys/androidannotations/issues/comments/125599121","html_url":"https://github.com/excilys/androidannotations/issues/1504#issuecomment-125599121","issue_url":"https://api.github.com/repos/excilys/androidannotations/issues/1504","id":125599121,"user":{"login":"smac89","id":8305511,"avatar_url":"https://avatars.githubusercontent.com/u/8305511?v=3","gravatar_id":"","url":"https://api.github.com/users/smac89","html_url":"https://github.com/smac89","followers_url":"https://api.github.com/users/smac89/followers","following_url":"https://api.github.com/users/smac89/following{/other_user}","gists_url":"https://api.github.com/users/smac89/gists{/gist_id}","starred_url":"https://api.github.com/users/smac89/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smac89/subscriptions","organizations_url":"https://api.github.com/users/smac89/orgs","repos_url":"https://api.github.com/users/smac89/repos","events_url":"https://api.github.com/users/smac89/events{/privacy}","received_events_url":"https://api.github.com/users/smac89/received_events","type":"User","site_admin":false},"created_at":"2015-07-28T13:02:53Z","updated_at":"2015-07-28T13:02:53Z","body":"I solved this by making the activity implement the interface needed and now I can annotate those methods and it works.\r\nThanks for the reminder"}}