This fragment contains a Dialog object, which it displays as appropriate based on the fragment’s state. Control of the dialog (deciding when to show, hide, dismiss it) should be done through the API here, not with direct calls on the dialog.
We do inherit from this class(
android.support.v4.app.DialogFragment) then implement the
Fragment.onCreateView(LayoutInflater, ViewGroup, Bundle) to supply the content of the dialogfragment.
You can also override
onCreateDialog(Bundle) to create an entirely custom dialog, such as an AlertDialog, with its own content.
Android DialogFragment Example
Let’s see a Kotlin android Dialog Fragment example with Kotlin.