Abstract base class which presents a dialog associated with a DialogPreference. Since
the preference object may not be available during fragment re-creation, the necessary
information for displaying the dialog is read once during the initial call to
onCreate(Bundle) and saved/restored in the saved instance state. Custom subclasses
should also follow this pattern.

This method is deprecated.
This has been removed in favor of getParentFragmentManager() which
throws an IllegalStateException if the FragmentManager is null. Check if
isAdded() returns false to determine if the FragmentManager is
null.

This method is deprecated.
Instead of retaining the Fragment itself, use a non-retained Fragment and keep
retained state in a ViewModel attached to that Fragment. The ViewModel's constructor and
its onCleared() callback provide the signal for initial creation and final destruction of
the retained state.

This method is deprecated.
This has been renamed to getParentFragmentManager() to make it
clear that you are accessing the FragmentManager that contains this Fragment and not the
FragmentManager associated with child Fragments.

This method is deprecated.
Instead of retaining the Fragment itself, use a non-retained Fragment and keep
retained state in a ViewModel attached to that Fragment. The ViewModel's constructor and
its onCleared() callback provide the signal for initial creation and final destruction of
the retained state.

onCreate

Note that this can be called while the fragment's activity is
still in the process of being created. As such, you can not rely
on things like the activity's content view hierarchy being initialized
at this point. If you want to do work once the activity itself is
created, add a LifecycleObserver on the
activity's Lifecycle, removing it when it receives the
Lifecycle.State.CREATED callback.

Any restored child fragments will be created before the base
Fragment.onCreate method returns.

Parameters

savedInstanceState

Bundle: If the fragment is being re-created from
a previous saved state, this is the state.

onCreateDialog

Override to build your own custom Dialog container. This is typically
used to show an AlertDialog instead of a generic Dialog; when doing so,
Fragment.onCreateView(LayoutInflater, ViewGroup, Bundle) does not need
to be implemented since the AlertDialog takes care of its own content.

This corresponds to Activity.onSaveInstanceState(Bundle) and most of the discussion there
applies here as well. Note however: this method may be called
at any time before onDestroy(). There are many situations
where a fragment may be mostly torn down (such as when placed on the
back stack with no UI showing), but its state will not be saved until
its owning activity actually needs to save its state.