Listener Dialog on Dismissed (LDD)


LDD:   SOLD       




Hi dev, initially I didn't need this feature, but as my app progressed further, I ended up needing to execute code when the Dialog family component was Dismissed.

Well, to make a long story short, I did a little overhaul, where previously I initialized this dialog component in a function/method, then I changed the method to be more open for one class, so I declared the dialog in a class like this  private lateinit var dialog: Dialog, then I initialized it in onCreate, so this component is ready to use in any function (in one class).

Back to the topic, so to find out when the dialog component is Dismissed is by calling the callback  setOnDismissListener, for example like this.

        dialog.setOnDismissListener {
           //execute your code here
        }

You can see that I'm using Kotlin, so that's it... good luck!


Post a Comment

Previous Next

نموذج الاتصال