1. Android has four default dialog implementations: alertdialog, progressdialog, datepickerdialog, and timepickerdialog. In addition, you can inherit Android. App. dialog to implement your own dialog.
2. alertdialog is a dialog box that constructs the default one, two, and three buttons, and one or multiple choice dialog box.
3. progressdialog is derived from alertdialog. In addition to the alertdialog function, progressdialog can display the progress circle or dialog box.
4. datepickerdialog/timepickerdialog is a dialog box that allows users to select a date and a time respectively.
5. Dialog lifecycle callback method: by default, dialog belongs to an activity. The entire lifecycle of the dialog from creation to closure is related to the following callback methods of the activity: oncreatedialog (INT) is called only when the dialog is generated for the first time; onpreparedialog (INT) it is called each time the dialog is displayed. Showdialog (INT) displays dialog; dismissdialog (INT) disables dialog. In addition, you can directly call the dismiss and cancel methods of dialog. When you press the "back" key, the dialog will also be cancel. So when you want to monitor when the dialog is canceled, You can implement the dialoginterface. ondismisslistener interface, and then call the setondismisslistener method to listen.
6. Create alertdialog. Create button dialog box. The syntax for creating a dialog box is as follows: New alertdialog. builder (this ). setmessage (string ). setpositiebutton ("name", new dialoginterface. onclicklistener () {public void onclice ()}). the basic syntax of create (); is to set relevant attributes in the method chain, and pass in the callback method of the button through the internal class.
7. Add list in alertdialog. The syntax is similar to the create button dialog box. New alertdialog. Builder (this). settitle (""). setitems (charsequence [], new dialoginterface. onclicklistener () {public void onclick () {}}). Create.
8. Create a single-choice alertdialog. The syntax is similar to that of the create List dialog box. The difference is that the setitems method is replaced by setsinglechoiceitems ()/setmultichoiceitems.
9. Create progressdialog. Progress bar for creating a circle: progressdialog. Show (context, ""); Create a progress bar: New processdialog (context). setprogressstyle (). setcancelable (). After a progress bar is created, another thread calls dialog. incrementprogressby (INT) to set the progress.
10. Create a custom dialog box. Create a layout in layout. Then you can directly create a new dialog (getapplicationcontext (). setcontentview (R. layout. xx.