Creates an AlertDialog with the arguments supplied to this builder. It does not display the dialog. This allows the user to do any extra processing before displaying the dialog.
1. Instantiate a new AlertDialog.Builder
2. You may want to add a title, add a message, set it non-cancelable, add a positive button, add a negative button, or add a neutral button. However, none of these options are required. If no items are added, the dialog will still display and look like the whole screen dims and the user will not be able to press any items on the screen. Pressing the back button will remove the AlertDialog with no items set.
3. Declare an AlertDialog object named myDialog.
4. Add the below code to supply the arguments the builder and save it to the myDialog variable.
myDialog = myAlertDialogBuilder.create();
5. Make sure to return the myDialog.
return myDialog;
6. Compile and run!
Next Recommended Article: How to Display an AlertDialog from a Button
Resources:
http://developer.android.com/reference/android/app/AlertDialog.Builder.html#create()