<How to make a button in Dialog close that Dialog ...
# stackoverflow
u
How to make a button in Dialog close that Dialog (Kotlin) I have a custom dialog that's initialized in onCreate() of some Activity. It displays some text and a button. I want the button to close the dialog when clicked. How can I achieve this? Here's my attempt that fails. MyActivity.kt class MyActivity : AppCompatActivity() { private lateinit var myDialog: Dialog override fun onCreate(savedInstanceState: Bundle?) { ... myDialog = Dialog(this) myDialog.setContentView(R.layout.my_dialog_layout) val button =...