Can you fire an event when Android Dialog is dismissed? Can you fire an event when Android Dialog is dismissed? android android

Can you fire an event when Android Dialog is dismissed?


Sure you can - check:

  public void onDismiss(DialogInterface dialogInterface)  {        //Fire event  }


Whenever a dialog is closed either by clicking PositiveButton, NegativeButton, NeturalButton or by clicking outside of the dialog, "onDismiss" is always gets called automatically so do your stuff inside the onDismiss() method e.g.,

@Overridepublic void onDismiss(DialogInterface dialogInterface) {    ...}

You don't even need to call dismiss() method.