Android Dialog


show();Shows the dialog
setContentView(R.layout.yourlayout);sets the ContentView of the dialog to your custom layout.
dismiss()Closes the dialog


  • The dialog in the first example(Dialog) does not need to call show() when it is created as it is handled in the constructor

  • Alert Dialogs must be constructed through a new instance of the AlertDialog.Builder() class. Following the Builder Pattern, all members of the AlertDialog.Builder can be method chained to 'build up' the dialog instance.

  • The Alert Dialog builder can directly show() the dialog -- you do not need to call create() then show() on the AlertDialog instance