Adding to the other answers, when having a DialogFragment
that is full screen calling dismiss()
won't pop the DialogFragment from the fragment backstack. A workaround is to call onBackPressed()
on the parent activity.
Something like this:
CustomDialogFragment.kt
closeButton.onClick {
requireActivity().onBackPressed()
}