O Google tem o compromisso de promover a igualdade racial para as comunidades negras. Saiba como.


open class AlertDialog : AppCompatDialog, DialogInterface
   ↳ android.app.Dialog
   ↳ androidx.appcompat.app.AppCompatDialog
   ↳ androidx.appcompat.app.AlertDialog

A subclass of Dialog that can display one, two or three buttons. If you only want to display a String in this dialog box, use the setMessage() method. If you want to display a more complex view, look up the FrameLayout called "custom" and add your view to it:

FrameLayout fl = findViewById(android.R.id.custom);
  fl.addView(myView, new LayoutParams(MATCH_PARENT, WRAP_CONTENT));

The AlertDialog class takes care of automatically setting android.view.WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM for you based on whether any views in the dialog return true from View.onCheckIsTextEditor(). Generally you want this set for a Dialog without text editors, so that it will be placed on top of the current input method UI. You can modify this behavior by forcing the flag to your desired mode after calling #onCreate.


Nested classes

Protected constructors
<init>(@NonNull context: Context)

<init>(@NonNull context: Context, @StyleRes themeResId: Int)

Construct an AlertDialog that uses an explicit theme.

<init>(@NonNull context: Context, cancelable: Boolean, @Nullable cancelListener: OnCancelListener?)

Public methods
open Button!
getButton(whichButton: Int)

Gets one of the buttons used in the dialog.

open ListView!

Gets the list view used in the dialog.

open Boolean
onKeyDown(keyCode: Int, event: KeyEvent)

open Boolean
onKeyUp(keyCode: Int, event: KeyEvent)

open Unit
setButton(whichButton: Int, text: CharSequence!, msg: Message!)

Sets a message to be sent when a button is pressed.

open Unit
setButton(whichButton: Int, text: CharSequence!, listener: OnClickListener!)

Sets a listener to be invoked when the positive button of the dialog is pressed.

open Unit
setButton(whichButton: Int, text: CharSequence!, icon: Drawable!, listener: OnClickListener!)

Sets an icon to be displayed along with the button text and a listener to be invoked when the positive button of the dialog is pressed.

open Unit
setCustomTitle(customTitleView: View!)

This method has no effect if called after show().

open Unit
setIcon(resId: Int)

Set resId to 0 if you don't want an icon.

open Unit
setIcon(icon: Drawable!)

Set the Drawable to be used in the title.

open Unit

Sets an icon as supplied by a theme attribute.

open Unit

Sets the message to display.

open Unit

open Unit
setView(view: View!)

Set the view to display in the dialog.

open Unit
setView(view: View!, viewSpacingLeft: