code: def init_widget(self):
          
          w = self.dialog
          # Listen for events
          w.setOnDismissListener(w.getId())
          w.onDismiss.connect(self.on_dismiss)
          w.setOnCancelListener(w.getId())
          w.onCancel.connect(self.on_cancel)
          super(AndroidDialog, self).init_widget()
docs: Set the listeners