Stats

274 Contributors: 16
Friday, March 24, 2017
Licensed under: CC-BY-SA
Not affiliated with Stack Overflow
Rip Tutorial: info@zzzprojects.com

Download eBook

Dialog

Download android eBook

Parameters

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

Remarks

  • 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

Related Examples