Skip to content

Most visited

Recently visited



public class AppCompatDialogFragment
extends DialogFragment

Known Direct Subclasses

A special version of DialogFragment which uses an AppCompatDialog in place of a platform-styled dialog.

See also:


Inherited constants

From class

Public constructors


Public methods

Dialog onCreateDialog(Bundle savedInstanceState)

Override to build your own custom Dialog container.

Inherited methods

From class
From class
From class java.lang.Object
From interface android.content.DialogInterface.OnCancelListener
From interface android.content.DialogInterface.OnDismissListener
From interface android.content.ComponentCallbacks
From interface android.view.View.OnCreateContextMenuListener

Public constructors


AppCompatDialogFragment ()

Public methods


Dialog onCreateDialog (Bundle savedInstanceState)

Override to build your own custom Dialog container. This is typically used to show an AlertDialog instead of a generic Dialog; when doing so, onCreateView(LayoutInflater, ViewGroup, Bundle) does not need to be implemented since the AlertDialog takes care of its own content.

This method will be called after onCreate(Bundle) and before onCreateView(LayoutInflater, ViewGroup, Bundle). The default implementation simply instantiates and returns a Dialog class.

Note: DialogFragment own the Dialog.setOnCancelListener and Dialog.setOnDismissListener callbacks. You must not set them yourself. To find out about these events, override onCancel(DialogInterface) and onDismiss(DialogInterface).

savedInstanceState Bundle: The last saved instance state of the Fragment, or null if this is a freshly created Fragment.
Dialog Return a new Dialog instance to be displayed by the Fragment.
This site uses cookies to store your preferences for site-specific language and display options.


This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.