Search code examples
androiddialogcustomdialog

Android - entries in dialog should be deleted when dialog is closed


I have a customDialog with input fields. I want possible entries to be removed once the dialog is closed (either via back or when a certain button is pressed), i.e. the state should not be saved.

How can I do that?


Solution

  • If the back button is pressed means that dialog is canceled. Implement DialogInterface.OnCancelListener for your dialog and empty/delete/null the entries you want.