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));
Content copied to clipboard
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.
Functions
Link copied to clipboard
Gets the list view used in the dialog.
Link copied to clipboard
Sets a listener to be invoked when the positive button of the dialog is pressed.
Sets a message to be sent when a button is pressed.
open fun setButton(whichButton: Int, text: CharSequence, icon: Drawable, listener: DialogInterface.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.
Link copied to clipboard
This method has no effect if called after show.
Link copied to clipboard
Sets an icon as supplied by a theme attribute.
Link copied to clipboard
Sets the message to display.
Link copied to clipboard
Link copied to clipboard