Search code examples
javaandroidandroid-fragmentsandroid-dialogandroid-dialogfragment

Run a method after a dialog is dismissed - Android


I have a fragment that creates a dialogFragment with no buttons. I want the fragment to run a method after the dialog has been dismissed by either the back button or by clicking outside of the dialog. I have tried looking for an answer, but all I have found is the possibility of setting up positive/negative/neutral buttons. I wouldn't want buttons if possible. How could this be accomplished?

Note: I have tried onResume(), but that doesn't get called after the dialog is dismissed.


Solution

  • override the onDismiss method in the DialogFragment, that gets called when the dialog gets dismissed