Accessibility dialog - Android
On Android, you can show a dialog by using AlertDialog
, BottomSheetDialog
or DialogFragment
. You should always add a close button by using the setNegativeButton
method. The focus of assistive technologies is automatically trapped inside the dialog while it's visible.
val builder = AlertDialog.Builder(this)
builder.setTitle("Confirm Appt membership?")
builder.setMessage("Your bank account will be billed.")
builder.setPositiveButton("Proceed") { dialog, which ->
// Proceed
}
builder.setNegativeButton("Cancel") { dialog, which ->
// Cancel
}
builder.show()