//create builder. val alertdialog : AlertDialog = AlertDialog.Builder(this).create() //Set the title of alert dialog. alertdialog.setTitle("Exit Dialog") //set message. alertdialog.setMessage("do you want exit?")
//positive button. alertdialog.setButton(AlertDialog.BUTTON_POSITIVE,"Yes"){ dialog, which -> finish() dialog.dismiss()} //negative button. alertdialog.setButton(AlertDialog.BUTTON_NEGATIVE,"No"){ dialog, which -> dialog.dismiss() } //show the dialog alertdialog.show()
0 Comments