What is lifecycle of DialogFragment

前端 未结 3 1325
心在旅途
心在旅途 2020-12-30 02:50

I could not find proper lifecycle of android.support.v4.app.DialogFragment by searching on Google. I need this for some implementation. As we know DialogF

3条回答
  •  粉色の甜心
    2020-12-30 03:05

    DialogFragment life cycle is similar to the life cycle of fragment:. To test yourself put logs in each of the overrided methods of dialogFragment and then run your code you will understand the working of dialogFragment.

    onAttach
    onCreate
    onCreateDialog
    onCreateView
    onActivityCreated
    onStart
    onResume
    

    And as far as finishing or destroying dialogFragment is concerned the lifeCycle is as follows:

    onPause
    onStop
    onDestroyView
    onDestroy
    onDetach
    

    Also I believe this method will also help you know the lifecycle :

    @NonNull
    @Override
    public Lifecycle getLifecycle() {
        return super.getLifecycle();
    }
    

提交回复
热议问题