Use of the system's own Dialog box AlertDialog is the simplest Dialog box in the project, mainly for the purpose of displaying a warning message for the user. AlertDialog is also the most used class in Dialog boxes, and it is a direct subclass of Dialog. Its inheritance structure is as follows:  java.lang.Object ? android.app.Dialog ? If you want to instantiate an AlertDialog class, you usually rely on its internal class: AlertDialog.Builder. Methods: Public void setTitle(CharSequence Title) public void setTitle(int titleId) Public void show() public void hide() Public Boolean isShowing() Check whether the dialog displays public void SetContentView (View View) Sets the View component public void setContentView(int layoutResID) Sets the ID of the View component public void Dismiss () Hides the dialog box Public void setDismissMessage(Message MSG) Sets the Message for hiding the dialog box. Public void closeOptionsMenu() closes the option menu SetCancelable (Boolean flag) Set whether to cancel public void setCancelMessage(Message MSG) Set the Message to cancel the dialog box public void cancel() Cancel the dialog box, And dismiss () method in the similar public Window getWindow () the Window object public void setOnShowListener (DialogInterface. OnShowListener Listener) Settings dialog opens to monitor public void setOnDismissListener (DialogInterface. OnDismissListener listener) dialog hidden when listening public void SetOnCancelListener (DialogInterface. OnCancelListener listener) Settings dialog canceled when listening * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Alertdialog. Builder () Builder(Context Context) Creates an Alertdialog. Builder object. Public Alertdialog. Builder setMessage (int MessageId) Specifies the resource ID of the information to be displayed. Public AlertDialog.Builder setMessage (CharSequence Message) Specifies the character string public Alertdialog. Builder setView(View View) Public AlertDialog.Builder setSingleChoiceItems (CharSequence[] Items, int checkedItem, DialogInterface. An OnClickListener listener) Settings dialog displays a List of radio, specify the default selected item, Builder setSingleChoiceItems (ListAdapter adapter int checkedItem, DialogInterface. An OnClickListener listener) Settings dialog displays a List of radio, specify the default selected item, Public AlertDialog.Builder setMultiChoiceItems (CharSequence[] items, Boolean [] checkedItems, DialogInterface. OnMultiChoiceClickListener listener) Settings dialog displays a check List, Public Alertdialog. Builder setPositiveButton (CharSequence text, DialogInterface. An OnClickListener listener) to add a confirmation button dialog, Public Alertdialog. Builder setPositiveButton (int textId, DialogInterface. An OnClickListener listener) for a confirmation dialog box to add button, display content specified by the resource file, Public alertdialog. Builder setNegativeButton (CharSequence text, DialogInterface. An OnClickListener listener) for setting a cancel button dialog, Public alertdialog. Builder setNegativeButton (int textId, DialogInterface. An OnClickListener listener) to set up a cancel button dialog, display content specified by the resource file, Public Alertdialog. Builder setNeutralButton (CharSequence text, DialogInterface. An OnClickListener listener) to set up a common button, And set to monitor the operation of public AlertDialog. Builder setNeutralButton (int textId, DialogInterface. An OnClickListener listener) to set up a common button, The display content is specified by the resource file, Public alertdialog. Builder setItems (CharSequence[] items, DialogInterface. An OnClickListener listener) sets the information content to list items, At the same time set up to monitor operating public AlertDialog. Builder setItems (int itemsId, DialogInterface. An OnClickListener listener) sets the information content to list items, The list item contents are specified by the resource file, Public AlertDialog Create () Creates an instantiation object of an AlertDialog. Public AlertDialog.Builder setIcon(Drawable icon) Sets the icon to display Public alertdialog. Builder setIcon(int iconId) Sets the ID of the resource to display * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 3, using a custom layout Dialog steps: 1, a custom layout XML files acvitity_custom_dialog. XML; Add an ID to the control that needs to obtain text content in the custom layout. 2. Obtain the layout loader object LayoutInflater Factory =LayoutInflater. View myView =factory.inflate(); Myview.findviewbyid () = myView.findViewById () = myView.findById () = myView ();Copy the code