Update 17 May 2021:
Quoting from Android Documentation:
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.
You should use a DialogFragment
as a container for your dialog. The DialogFragment
class provides all the controls you need to create your dialog and manage its appearance, instead of calling methods on the Dialog
object.
Using DialogFragment
to manage the dialog ensures that it correctly handles lifecycle events such as when the user presses the Back button or rotates the screen. The DialogFragment
class also allows you to reuse the dialog's UI as an embeddable component in a larger UI, just like a traditional Fragment
(such as when you want the dialog UI to appear differently on large and small screens).
Note: AppCompatDialog
is a Dialog
extension.
Previous answer (Nov 16 '19):
The DialogFragment and the AppCompatDialog are completely different.
As per Gabriele Mariotti comment.