Android Alert Dialog |Android App Development With AndroidCource

Friday 15 September 2017

Android Alert Dialog

Alert Dialog


AlertDialog can be used to display the dialog message with OK and Cancel buttons.

AlertDialog is composed of three regions: title, content area and action buttons.

A dialog is a small window that prompts the user to make a decision or enter additional information.

AlertDialog is the subclass of Dialog class.

AlertDialog need to make an object of AlertDialogBuilder which an inner class of AlertDialog.

Now you have to set the positive (yes) or negative (no) button using the object of the AlertDialogBuilder class.

Methods of AlertDialog


setMessage()

Sets the message to be displayed in the alert dialog

setIcon()

sets the icon in the alert dialog

setCancelable()

Sets the property that the dialog can be cancelled or not

setTitle()

Set the title to be appear in the dialog

show()

Show Display Dialog

0 comments:

Post a Comment