I create dialog box by extending AppCompatDialogFragment(). I have one EditText field and Positive/Negative button. When I click on the Positive button I want to keep the value on the EditText, so when I reopen the dialog the value will be already written there.
Positive button (inside onCreateDialog()) - I send text to MainActivity
.setPositiveButton("apply", DialogInterface.OnClickListener(){ _: DialogInterface, _: Int ->
(activity as MainActivity?)?.updateDelay(textDelay.text.toString())
})