Dialogs in Android with Data Binding


A dialog is a small window that prompts the user to make a decision or enter additional information. A dialog does not fill the screen and is normally used for modal events that require users to take an action before they can proceed.

Building an Alert Dialog
The AlertDialog class allows you to build a variety of dialog designs and is often the only dialog class you’ll need. As shown in figure 2, there are three regions of an alert dialog:

This is optional and should be used only when the content area is occupied by a detailed message, a list, or custom layout. If you need to state a simple message or question (such as the dialog in figure 1), you don’t need a title.
Content area
This can display a message, a list, or other custom layout.
Action buttons
There should be no more than three action buttons in a dialog.

First in gradle add below code first for databinding





screenshot-1510384637879 screenshot-1510384630612 screenshot-1510384623386 screenshot-1510384614971 screenshot-1510384605511

Leave a Reply