{"action":"created","issue":{"url":"https://api.github.com/repos/excilys/androidannotations/issues/486","labels_url":"https://api.github.com/repos/excilys/androidannotations/issues/486/labels{/name}","comments_url":"https://api.github.com/repos/excilys/androidannotations/issues/486/comments","events_url":"https://api.github.com/repos/excilys/androidannotations/issues/486/events","html_url":"https://github.com/excilys/androidannotations/issues/486","id":10576212,"number":486,"title":"@AfterViews in DialogFragment","user":{"login":"dhleong","id":816150,"avatar_url":"https://avatars.githubusercontent.com/u/816150?v=3","gravatar_id":"","url":"https://api.github.com/users/dhleong","html_url":"https://github.com/dhleong","followers_url":"https://api.github.com/users/dhleong/followers","following_url":"https://api.github.com/users/dhleong/following{/other_user}","gists_url":"https://api.github.com/users/dhleong/gists{/gist_id}","starred_url":"https://api.github.com/users/dhleong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dhleong/subscriptions","organizations_url":"https://api.github.com/users/dhleong/orgs","repos_url":"https://api.github.com/users/dhleong/repos","events_url":"https://api.github.com/users/dhleong/events{/privacy}","received_events_url":"https://api.github.com/users/dhleong/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":18,"created_at":"2013-02-02T20:07:55Z","updated_at":"2015-06-09T14:57:15Z","closed_at":"2015-06-09T09:58:13Z","body":"I have a DialogFragment that I'm planning to use in both Dialog mode and embedded mode. I have an `AfterViews` method that doesn't seem to get called when the fragment is used as a Dialog. This also means, of course, that @Click methods, etc. don't fire.\r\n\r\nI'm using the 3.0 snapshot.\r\n\r\nMy fragment looks something like the following, because I want to use dialog buttons where available, and to avoid crashes that may be support library-related:\r\n\r\n```\r\n// members, etc.\r\n\r\n    @Override\r\n    public View onCreateView(LayoutInflater inflater, ViewGroup container,\r\n            Bundle savedInstanceState) {\r\n        \r\n        // in dialog mode... don't do anything (I guess) to prevent \r\n        //  \"requestFeature() must be called before adding content\" exception\r\n        if (getDialog() != null)\r\n            return null;\r\n        \r\n        View view = inflater.inflate(R.layout.frag_create_post, null);\r\n        \r\n        prepareView(view); // because @AfterViews isn't working\r\n        \r\n        return view;\r\n    }\r\n    \r\n    @Override\r\n    public Dialog onCreateDialog(Bundle savedInstanceState) {\r\n\r\n        final View view = LayoutInflater.from(getActivity())\r\n                .inflate(R.layout.frag_create_post, null);\r\n        prepareView(view); // because @AfterViews isn't working\r\n        \r\n        AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());\r\n        builder\r\n            .setView(view)\r\n            .setPositiveButton(R.string.share, this)\r\n            .setNegativeButton(R.string.cancel, null);\r\n        \r\n        return builder.create();\r\n    }\r\n```\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/excilys/androidannotations/issues/comments/110392691","html_url":"https://github.com/excilys/androidannotations/issues/486#issuecomment-110392691","issue_url":"https://api.github.com/repos/excilys/androidannotations/issues/486","id":110392691,"user":{"login":"OskJonsdottir","id":11447204,"avatar_url":"https://avatars.githubusercontent.com/u/11447204?v=3","gravatar_id":"","url":"https://api.github.com/users/OskJonsdottir","html_url":"https://github.com/OskJonsdottir","followers_url":"https://api.github.com/users/OskJonsdottir/followers","following_url":"https://api.github.com/users/OskJonsdottir/following{/other_user}","gists_url":"https://api.github.com/users/OskJonsdottir/gists{/gist_id}","starred_url":"https://api.github.com/users/OskJonsdottir/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OskJonsdottir/subscriptions","organizations_url":"https://api.github.com/users/OskJonsdottir/orgs","repos_url":"https://api.github.com/users/OskJonsdottir/repos","events_url":"https://api.github.com/users/OskJonsdottir/events{/privacy}","received_events_url":"https://api.github.com/users/OskJonsdottir/received_events","type":"User","site_admin":false},"created_at":"2015-06-09T14:57:15Z","updated_at":"2015-06-09T14:57:15Z","body":"As mentioned above by @pyricau, the javadoc of `FragmentDialog` states \"Implementations should override this class and implement onCreateView(LayoutInflater, ViewGroup, Bundle) to supply the content of the dialog.\"\r\n\r\nBut the sentence right after that one reads \"**Alternatively, they can override onCreateDialog(Bundle) to create an entirely custom dialog, such as an AlertDialog, with its own content**\".\r\n\r\nWhen @dodgex says \"I have a `DialogFragment` where everything works just fine\", she or he should specify that it is \"a `DialogFragment` that does NOT implement `onCreateDialog`\". If understand the original sense of this issue, the problem reported here is that there is no way to use Android Annotations if you want to create a `DialogFragment` that implements `onCreateDialog()`. \r\n\r\nIf you annotate your `FragmentDialog` with `@EFragment`, then `onCreateView()` is automatically implemented in the annotated class to return the content view described by the layout value passed to the `@EFragment` annotation. If you class also implements `onCreateDialog()`, an exception is thrown during creation."}}