Consider this code:
override fun onBackPressed() {
AlertDialog.Builder(this).apply {
setTitle("Exit")
setMessage("Are you sure you want to exit the app?")
setPositiveButton("Yes") { _, _ ->
...
}
setNegativeButton("No", null)
}.show()
}
Write the missing line represented by ... so that the default back action takes place when the "Yes" button is pressed.