Android DialogFragment onViewCreated not called

后端 未结 6 2024
攒了一身酷
攒了一身酷 2020-12-15 16:16

I am using android compatibility library (v4 revision 8). In the custom DialogFragment the overrided method onViewCreated is not getting called.For eg.

publi         


        
6条回答
  •  Happy的楠姐
    2020-12-15 16:48

    The documentation states that onCreateDialog will be called before onCreateView (DialogFragment documentation) and onCreateView will be called before onActivityCreated (Fragment documentation. Therefore this would be the flow of calls:

    onCreate
    onCreateDialog
    onCreateView
    onActivityCreated
    

    So do what you would do in OnViewCreated in onActivityCreated and you should be set.

提交回复
热议问题