Design + Code an Android App from Scratch
This video talks about a fragment that displays a dialog window, floating on top of its activity's window called a DialogFragment in Android. This fragment contains a Dialog object, which it displays as appropriate based on the fragment's state. Control of the dialog (deciding when to show, hide, dismiss it) should be done through the API here, not with direct calls on the dialog. You can implement one either using the Fragment approach in which case you use the onCreateView method or the Dialog approach in which case you use the onCreateDialog approach. Create an XML layout of the Dialog that you want to display. Create a class that extends from DialogFragment. Override the onCreateView method or the onCreateDialog method depending on your chosen approach. Construct the object of a DialogFragment inside your activity and simply call the show method to display the Dialog or dismiss method to destroy the Dialog.