Skip to main content
Logo Appt Light

Accessibility dialog on Android

A dialog overlays the screen and offers one or more actions to proceed. Dialogs should always include a close button to make them accessible for users of assistive technologies. Furthermore, the focus of assistive technologies should be trapped inside the dialog while it's visible.

On Android, you can show a dialog by using AlertDialogBottomSheetDialog 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


Let us know!