What's missing?

Report a typo

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.

Enter a short text
___

Create a free account to access the full topic