How can I listen to a FINAL dismissal of a BottomSheetDialogFragment
? I want to save user changes on the final dismissal only...
I tried following:
i achieved this using this simple trick
val bottomSheetDialog = FeedbackFormsFragment.createInstance()
bottomSheetDialog.show((activity as FragmentActivity).supportFragmentManager, BOTTOM_SHEET)
// add some delay to allow the bottom sheet to be visible first so that the dialog is not null
Handler().postDelayed({
bottomSheetDialog.dialog?.setOnDismissListener {
// add code here
}
}, 1000)