Dialog-Box in android is used to show a message in the form of a dialog with a button.

In case of form filling if you miss any option then a dialog box will open up asking to fill all the fields in this way a dialog box will be used.

 

 

 

MainActivity.java

Adding textview and button to xml screen.

activity_main.xml

Now we have to design dialog box, we can set textview, edittext, buttons and more depending upon requirement.

Here i am showing you a default dialog-box where i have taken a textview and button  

dialog.xml

AndroidManifest.xml

Output :

dialog1

Show Buttons
Hide Buttons
Read previous post:
Android Tutorial on Check-Box

Close