blonsky95 / TimeStopperAndroid

0 stars 0 forks source link

Back button triggers dialog window to exit app #12

Closed blonsky95 closed 4 years ago

blonsky95 commented 4 years ago

Worked with this:

     override fun onBackPressed() {
      val dialogBuilder = AlertDialog.Builder(this)
        .setMessage("Are you sure you want to quit?")
        .setPositiveButton(
            "Yes"
        ) { _, _ -> super.onBackPressed()}
        .setNegativeButton("No",null)
        .setCancelable(true)
      dialogBuilder.show()
       }