Android AlertDialog for Confirmation

July 24, 2018

Implement a Yes/No confirmation dialog.

AlertDialog.Builder(context)
        .setMessage("Confirm Delete?")
        .setPositiveButton(android.R.string.ok) { dialog, whichButton ->
            // do something
        }
        .setNegativeButton(android.R.string.cancel, null)
        .show()
This work is licensed under a
Creative Commons Attribution-NonCommercial 4.0 International License.