{"action":"created","issue":{"url":"https://api.github.com/repos/excilys/androidannotations/issues/1308","labels_url":"https://api.github.com/repos/excilys/androidannotations/issues/1308/labels{/name}","comments_url":"https://api.github.com/repos/excilys/androidannotations/issues/1308/comments","events_url":"https://api.github.com/repos/excilys/androidannotations/issues/1308/events","html_url":"https://github.com/excilys/androidannotations/issues/1308","id":54202559,"number":1308,"title":"The onPrepareOptionsMenu method may be called before Bean-objects injection.","user":{"login":"maximzhemerenko","id":7162289,"avatar_url":"https://avatars.githubusercontent.com/u/7162289?v=3","gravatar_id":"","url":"https://api.github.com/users/maximzhemerenko","html_url":"https://github.com/maximzhemerenko","followers_url":"https://api.github.com/users/maximzhemerenko/followers","following_url":"https://api.github.com/users/maximzhemerenko/following{/other_user}","gists_url":"https://api.github.com/users/maximzhemerenko/gists{/gist_id}","starred_url":"https://api.github.com/users/maximzhemerenko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maximzhemerenko/subscriptions","organizations_url":"https://api.github.com/users/maximzhemerenko/orgs","repos_url":"https://api.github.com/users/maximzhemerenko/repos","events_url":"https://api.github.com/users/maximzhemerenko/events{/privacy}","received_events_url":"https://api.github.com/users/maximzhemerenko/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/excilys/androidannotations/labels/Enhancement","name":"Enhancement","color":"0b02e1"}],"state":"closed","locked":false,"assignee":{"login":"WonderCsabo","id":480485,"avatar_url":"https://avatars.githubusercontent.com/u/480485?v=3","gravatar_id":"","url":"https://api.github.com/users/WonderCsabo","html_url":"https://github.com/WonderCsabo","followers_url":"https://api.github.com/users/WonderCsabo/followers","following_url":"https://api.github.com/users/WonderCsabo/following{/other_user}","gists_url":"https://api.github.com/users/WonderCsabo/gists{/gist_id}","starred_url":"https://api.github.com/users/WonderCsabo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WonderCsabo/subscriptions","organizations_url":"https://api.github.com/users/WonderCsabo/orgs","repos_url":"https://api.github.com/users/WonderCsabo/repos","events_url":"https://api.github.com/users/WonderCsabo/events{/privacy}","received_events_url":"https://api.github.com/users/WonderCsabo/received_events","type":"User","site_admin":false},"milestone":null,"comments":8,"created_at":"2015-01-13T14:55:57Z","updated_at":"2015-03-01T17:43:35Z","closed_at":"2015-03-01T17:43:35Z","body":"Usually onPrepareOptionsMenu method is called after all bean-objects have been injected, but in Android 4.1.1, 4.1.2 and possibly in other versions it happens vice versa.\r\nThis unexpected behavior may cause NullPointerException.\r\n\r\nMethod init_(Bundle savedInstanceState) (in generated class that extends Activity or Fragment) calls setHasOptionsMenu(true), which may have different implementations in various Android versions.\r\nIn this case it calls onPrepareOptionsMenu method immediately, but in Android 4.2+ versions onPrepareOptionsMenu call is postponed.\r\nThat's why it would be better to improve AndroidAnnotations lib to exclude calling onPrepareOptionsMenu method before bean-objects (and others) are injected.\r\n\r\nIn development we are using AndroidAnnotations version of 3.2."},"comment":{"url":"https://api.github.com/repos/excilys/androidannotations/issues/comments/76619324","html_url":"https://github.com/excilys/androidannotations/issues/1308#issuecomment-76619324","issue_url":"https://api.github.com/repos/excilys/androidannotations/issues/1308","id":76619324,"user":{"login":"WonderCsabo","id":480485,"avatar_url":"https://avatars.githubusercontent.com/u/480485?v=3","gravatar_id":"","url":"https://api.github.com/users/WonderCsabo","html_url":"https://github.com/WonderCsabo","followers_url":"https://api.github.com/users/WonderCsabo/followers","following_url":"https://api.github.com/users/WonderCsabo/following{/other_user}","gists_url":"https://api.github.com/users/WonderCsabo/gists{/gist_id}","starred_url":"https://api.github.com/users/WonderCsabo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WonderCsabo/subscriptions","organizations_url":"https://api.github.com/users/WonderCsabo/orgs","repos_url":"https://api.github.com/users/WonderCsabo/repos","events_url":"https://api.github.com/users/WonderCsabo/events{/privacy}","received_events_url":"https://api.github.com/users/WonderCsabo/received_events","type":"User","site_admin":false},"created_at":"2015-03-01T17:43:35Z","updated_at":"2015-03-01T17:43:35Z","body":"Implemented."}}