Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Inherited XML Attrs](https://developer.android.com/reference/android/app/DialogFragment#inhattrs) \| [Constants](https://developer.android.com/reference/android/app/DialogFragment#constants) \| [Inherited Constants](https://developer.android.com/reference/android/app/DialogFragment#inhconstants) \| [Ctors](https://developer.android.com/reference/android/app/DialogFragment#pubctors) \| [Methods](https://developer.android.com/reference/android/app/DialogFragment#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/app/DialogFragment#inhmethods)

# DialogFragment

*** ** * ** ***


`
public


class
DialogFragment
`


`


`

`

extends https://developer.android.com/reference/android/app/Fragment


`

`


implements

https://developer.android.com/reference/android/content/DialogInterface.OnCancelListener,

https://developer.android.com/reference/android/content/DialogInterface.OnDismissListener


`

|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) |||
| ↳ | [android.app.Fragment](https://developer.android.com/reference/android/app/Fragment) ||
|   | ↳ | android.app.DialogFragment |

<br />

*** ** * ** ***


**This class was deprecated
in API level 28.**   

Use the [Support Library](https://developer.android.com/tools/extras/support-library)
`https://developer.android.com/reference/androidx/fragment/app/DialogFragment.html` for consistent behavior across all devices
and access to [Lifecycle](https://developer.android.com/topic/libraries/architecture/lifecycle).

A fragment that displays a dialog window, floating on top of its
activity's window. 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.

Implementations should override this class and implement
`https://developer.android.com/reference/android/app/Fragment#onCreateView(android.view.LayoutInflater,%20android.view.ViewGroup,%20android.os.Bundle)` to supply the
content of the dialog. Alternatively, they can override
`https://developer.android.com/reference/android/app/DialogFragment#onCreateDialog(android.os.Bundle)` to create an entirely custom dialog, such
as an AlertDialog, with its own content.

Topics covered here:

1. [Lifecycle](https://developer.android.com/reference/android/app/DialogFragment#Lifecycle)
2. [Basic Dialog](https://developer.android.com/reference/android/app/DialogFragment#BasicDialog)
3. [Alert Dialog](https://developer.android.com/reference/android/app/DialogFragment#AlertDialog)
4. [Selecting Between Dialog or Embedding](https://developer.android.com/reference/android/app/DialogFragment#DialogOrEmbed)

### Lifecycle

DialogFragment does various things to keep the fragment's lifecycle
driving it, instead of the Dialog. Note that dialogs are generally
autonomous entities -- they are their own window, receiving their own
input events, and often deciding on their own when to disappear (by
receiving a back key event or the user clicking on a button).

DialogFragment needs to ensure that what is happening with the Fragment
and Dialog states remains consistent. To do this, it watches for dismiss
events from the dialog and takes care of removing its own state when they
happen. This means you should use `https://developer.android.com/reference/android/app/DialogFragment#show(android.app.FragmentManager,%20java.lang.String)`
or `https://developer.android.com/reference/android/app/DialogFragment#show(android.app.FragmentTransaction,%20java.lang.String)` to add an instance of
DialogFragment to your UI, as these keep track of how DialogFragment should
remove itself when the dialog is dismissed.


### Basic Dialog

The simplest use of DialogFragment is as a floating container for the
fragment's view hierarchy. A simple implementation may look like this:

```
public static class MyDialogFragment extends DialogFragment {
    int mNum;

    /**
     * Create a new instance of MyDialogFragment, providing "num"
     * as an argument.
     */
    static MyDialogFragment newInstance(int num) {
        MyDialogFragment f = new MyDialogFragment();

        // Supply num input as an argument.
        Bundle args = new Bundle();
        args.putInt("num", num);
        f.setArguments(args);

        return f;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mNum = getArguments().getInt("num");

        // Pick a style based on the num.
        int style = DialogFragment.STYLE_NORMAL, theme = 0;
        switch ((mNum-1)%6) {
            case 1: style = DialogFragment.STYLE_NO_TITLE; break;
            case 2: style = DialogFragment.STYLE_NO_FRAME; break;
            case 3: style = DialogFragment.STYLE_NO_INPUT; break;
            case 4: style = DialogFragment.STYLE_NORMAL; break;
            case 5: style = DialogFragment.STYLE_NORMAL; break;
            case 6: style = DialogFragment.STYLE_NO_TITLE; break;
            case 7: style = DialogFragment.STYLE_NO_FRAME; break;
            case 8: style = DialogFragment.STYLE_NORMAL; break;
        }
        switch ((mNum-1)%6) {
            case 4: theme = android.R.style.Theme_Holo; break;
            case 5: theme = android.R.style.Theme_Holo_Light_Dialog; break;
            case 6: theme = android.R.style.Theme_Holo_Light; break;
            case 7: theme = android.R.style.Theme_Holo_Light_Panel; break;
            case 8: theme = android.R.style.Theme_Holo_Light; break;
        }
        setStyle(style, theme);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
        View v = inflater.inflate(R.layout.fragment_dialog, container, false);
        View tv = v.findViewById(R.id.text);
        ((TextView)tv).setText("Dialog #" + mNum + ": using style "
                + getNameForNum(mNum));

        // Watch for button clicks.
        Button button = (Button)v.findViewById(R.id.show);
        button.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
                // When button is clicked, call up to owning activity.
                ((FragmentDialog)getActivity()).showDialog();
            }
        });

        return v;
    }
}
```

An example showDialog() method on the Activity could be:

```
void showDialog() {
    mStackLevel++;

    // DialogFragment.show() will take care of adding the fragment
    // in a transaction.  We also want to remove any currently showing
    // dialog, so make our own transaction and take care of that here.
    FragmentTransaction ft = getFragmentManager().beginTransaction();
    Fragment prev = getFragmentManager().findFragmentByTag("dialog");
    if (prev != null) {
        ft.remove(prev);
    }
    ft.addToBackStack(null);

    // Create and show the dialog.
    DialogFragment newFragment = MyDialogFragment.newInstance(mStackLevel);
    newFragment.show(ft, "dialog");
}
```

This removes any currently shown dialog, creates a new DialogFragment
with an argument, and shows it as a new state on the back stack. When the
transaction is popped, the current DialogFragment and its Dialog will be
destroyed, and the previous one (if any) re-shown. Note that in this case
DialogFragment will take care of popping the transaction of the Dialog
is dismissed separately from it.


### Alert Dialog

Instead of (or in addition to) implementing `https://developer.android.com/reference/android/app/Fragment#onCreateView(android.view.LayoutInflater,%20android.view.ViewGroup,%20android.os.Bundle)` to
generate the view hierarchy inside of a dialog, you may implement
`https://developer.android.com/reference/android/app/DialogFragment#onCreateDialog(android.os.Bundle)` to create your own custom Dialog object.

This is most useful for creating an `https://developer.android.com/reference/android/app/AlertDialog`, allowing you
to display standard alerts to the user that are managed by a fragment.
A simple example implementation of this is:

```
public static class MyAlertDialogFragment extends DialogFragment {

    public static MyAlertDialogFragment newInstance(int title) {
        MyAlertDialogFragment frag = new MyAlertDialogFragment();
        Bundle args = new Bundle();
        args.putInt("title", title);
        frag.setArguments(args);
        return frag;
    }

    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
        int title = getArguments().getInt("title");

        return new AlertDialog.Builder(getActivity())
                .setIcon(R.drawable.alert_dialog_icon)
                .setTitle(title)
                .setPositiveButton(R.string.alert_dialog_ok,
                    new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int whichButton) {
                            ((FragmentAlertDialog)getActivity()).doPositiveClick();
                        }
                    }
                )
                .setNegativeButton(R.string.alert_dialog_cancel,
                    new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int whichButton) {
                            ((FragmentAlertDialog)getActivity()).doNegativeClick();
                        }
                    }
                )
                .create();
    }
}
```

The activity creating this fragment may have the following methods to
show the dialog and receive results from it:

```
void showDialog() {
    DialogFragment newFragment = MyAlertDialogFragment.newInstance(
            R.string.alert_dialog_two_buttons_title);
    newFragment.show(getFragmentManager(), "dialog");
}

public void doPositiveClick() {
    // Do stuff here.
    Log.i("FragmentAlertDialog", "Positive click!");
}

public void doNegativeClick() {
    // Do stuff here.
    Log.i("FragmentAlertDialog", "Negative click!");
}
```

Note that in this case the fragment is not placed on the back stack, it
is just added as an indefinitely running fragment. Because dialogs normally
are modal, this will still operate as a back stack, since the dialog will
capture user input until it is dismissed. When it is dismissed, DialogFragment
will take care of removing itself from its fragment manager.


### Selecting Between Dialog or Embedding

A DialogFragment can still optionally be used as a normal fragment, if
desired. This is useful if you have a fragment that in some cases should
be shown as a dialog and others embedded in a larger UI. This behavior
will normally be automatically selected for you based on how you are using
the fragment, but can be customized with `https://developer.android.com/reference/android/app/DialogFragment#setShowsDialog(boolean)`.

For example, here is a simple dialog fragment:

```
public static class MyDialogFragment extends DialogFragment {
    static MyDialogFragment newInstance() {
        return new MyDialogFragment();
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
        View v = inflater.inflate(R.layout.hello_world, container, false);
        View tv = v.findViewById(R.id.text);
        ((TextView)tv).setText("This is an instance of MyDialogFragment");
        return v;
    }
}
```

An instance of this fragment can be created and shown as a dialog:

```
void showDialog() {
    // Create the fragment and show it as a dialog.
    DialogFragment newFragment = MyDialogFragment.newInstance();
    newFragment.show(getFragmentManager(), "dialog");
}
```

It can also be added as content in a view hierarchy:

```
FragmentTransaction ft = getFragmentManager().beginTransaction();
DialogFragment newFragment = MyDialogFragment.newInstance();
ft.add(R.id.embedded, newFragment);
ft.commit();
```

<br />

## Summary

### Inherited XML attributes

From class `https://developer.android.com/reference/android/app/Fragment` [`android:fragmentAllowEnterTransitionOverlap`](https://developer.android.com/reference/android/app/Fragment#attr_android:fragmentAllowEnterTransitionOverlap) Sets whether the enter and exit transitions should overlap when transitioning forward. [`android:fragmentAllowReturnTransitionOverlap`](https://developer.android.com/reference/android/app/Fragment#attr_android:fragmentAllowReturnTransitionOverlap) Sets whether the enter and exit transitions should overlap when transitioning because of popping the back stack. [`android:fragmentEnterTransition`](https://developer.android.com/reference/android/app/Fragment#attr_android:fragmentEnterTransition) The Transition that will be used to move Views into the initial scene. [`android:fragmentExitTransition`](https://developer.android.com/reference/android/app/Fragment#attr_android:fragmentExitTransition) The Transition that will be used to move Views out of the scene when the fragment is removed, hidden, or detached when not popping the back stack. [`android:fragmentReenterTransition`](https://developer.android.com/reference/android/app/Fragment#attr_android:fragmentReenterTransition) The Transition that will be used to move Views in to the scene when returning due to popping a back stack. [`android:fragmentSharedElementEnterTransition`](https://developer.android.com/reference/android/app/Fragment#attr_android:fragmentSharedElementEnterTransition) The Transition that will be used for shared elements transferred into the content Scene. [`android:fragmentSharedElementReturnTransition`](https://developer.android.com/reference/android/app/Fragment#attr_android:fragmentSharedElementReturnTransition) The Transition that will be used for shared elements transferred back during a pop of the back stack.

| ### Constants ||
|---|---|
| `int` | `https://developer.android.com/reference/android/app/DialogFragment#STYLE_NORMAL` Style for `https://developer.android.com/reference/android/app/DialogFragment#setStyle(int,%20int)`: a basic, normal dialog. |
| `int` | `https://developer.android.com/reference/android/app/DialogFragment#STYLE_NO_FRAME` Style for `https://developer.android.com/reference/android/app/DialogFragment#setStyle(int,%20int)`: don't draw any frame at all; the view hierarchy returned by `https://developer.android.com/reference/android/app/Fragment#onCreateView(android.view.LayoutInflater,%20android.view.ViewGroup,%20android.os.Bundle)` is entirely responsible for drawing the dialog. |
| `int` | `https://developer.android.com/reference/android/app/DialogFragment#STYLE_NO_INPUT` Style for `https://developer.android.com/reference/android/app/DialogFragment#setStyle(int,%20int)`: like `https://developer.android.com/reference/android/app/DialogFragment#STYLE_NO_FRAME`, but also disables all input to the dialog. |
| `int` | `https://developer.android.com/reference/android/app/DialogFragment#STYLE_NO_TITLE` Style for `https://developer.android.com/reference/android/app/DialogFragment#setStyle(int,%20int)`: don't include a title area. |

### Inherited constants

From interface `https://developer.android.com/reference/android/content/ComponentCallbacks2` `int` `https://developer.android.com/reference/android/content/ComponentCallbacks2#TRIM_MEMORY_BACKGROUND`

Level for `https://developer.android.com/reference/android/content/ComponentCallbacks2#onTrimMemory(int)`: the process has gone on to the
LRU list.


`int` `https://developer.android.com/reference/android/content/ComponentCallbacks2#TRIM_MEMORY_COMPLETE`

*This constant was deprecated
in API level 35.
Apps are not notified of this level since API level 34*


`int` `https://developer.android.com/reference/android/content/ComponentCallbacks2#TRIM_MEMORY_MODERATE`

*This constant was deprecated
in API level 35.
Apps are not notified of this level since API level 34*


`int` `https://developer.android.com/reference/android/content/ComponentCallbacks2#TRIM_MEMORY_RUNNING_CRITICAL`

*This constant was deprecated
in API level 35.
Apps are not notified of this level since API level 34*


`int` `https://developer.android.com/reference/android/content/ComponentCallbacks2#TRIM_MEMORY_RUNNING_LOW`

*This constant was deprecated
in API level 35.
Apps are not notified of this level since API level 34*


`int` `https://developer.android.com/reference/android/content/ComponentCallbacks2#TRIM_MEMORY_RUNNING_MODERATE`

*This constant was deprecated
in API level 35.
Apps are not notified of this level since API level 34*


`int` `https://developer.android.com/reference/android/content/ComponentCallbacks2#TRIM_MEMORY_UI_HIDDEN`

Level for `https://developer.android.com/reference/android/content/ComponentCallbacks2#onTrimMemory(int)`: the process had been showing
a user interface, and is no longer doing so.


| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/app/DialogFragment#DialogFragment()() ` |

| ### Public methods ||
|---|---|
| ` void` | ` https://developer.android.com/reference/android/app/DialogFragment#dismiss()() ` Dismiss the fragment and its dialog. |
| ` void` | ` https://developer.android.com/reference/android/app/DialogFragment#dismissAllowingStateLoss()() ` Version of `https://developer.android.com/reference/android/app/DialogFragment#dismiss()` that uses `https://developer.android.com/reference/android/app/FragmentTransaction#commitAllowingStateLoss()`. |
| ` void` | ` https://developer.android.com/reference/android/app/DialogFragment#dump(java.lang.String,%20java.io.FileDescriptor,%20java.io.PrintWriter,%20java.lang.String[])(https://developer.android.com/reference/java/lang/String prefix, https://developer.android.com/reference/java/io/FileDescriptor fd, https://developer.android.com/reference/java/io/PrintWriter writer, https://developer.android.com/reference/java/lang/String args) ` Print the Fragments's state into the given stream. |
| ` https://developer.android.com/reference/android/app/Dialog` | ` https://developer.android.com/reference/android/app/DialogFragment#getDialog()() ` |
| ` boolean` | ` https://developer.android.com/reference/android/app/DialogFragment#getShowsDialog()() ` Return the current value of `https://developer.android.com/reference/android/app/DialogFragment#setShowsDialog(boolean)`. |
| ` int` | ` https://developer.android.com/reference/android/app/DialogFragment#getTheme()() ` |
| ` boolean` | ` https://developer.android.com/reference/android/app/DialogFragment#isCancelable()() ` Return the current value of `https://developer.android.com/reference/android/app/DialogFragment#setCancelable(boolean)`. |
| ` void` | ` https://developer.android.com/reference/android/app/DialogFragment#onActivityCreated(android.os.Bundle)(https://developer.android.com/reference/android/os/Bundle savedInstanceState) ` Called when the fragment's activity has been created and this fragment's view hierarchy instantiated. |
| ` void` | ` https://developer.android.com/reference/android/app/DialogFragment#onAttach(android.content.Context)(https://developer.android.com/reference/android/content/Context context) ` Called when a fragment is first attached to its context. |
| ` void` | ` https://developer.android.com/reference/android/app/DialogFragment#onCancel(android.content.DialogInterface)(https://developer.android.com/reference/android/content/DialogInterface dialog) ` This method will be invoked when the dialog is canceled. |
| ` void` | ` https://developer.android.com/reference/android/app/DialogFragment#onCreate(android.os.Bundle)(https://developer.android.com/reference/android/os/Bundle savedInstanceState) ` Called to do initial creation of a fragment. |
| ` https://developer.android.com/reference/android/app/Dialog` | ` https://developer.android.com/reference/android/app/DialogFragment#onCreateDialog(android.os.Bundle)(https://developer.android.com/reference/android/os/Bundle savedInstanceState) ` Override to build your own custom Dialog container. |
| ` void` | ` https://developer.android.com/reference/android/app/DialogFragment#onDestroyView()() ` Remove dialog. |
| ` void` | ` https://developer.android.com/reference/android/app/DialogFragment#onDetach()() ` Called when the fragment is no longer attached to its activity. |
| ` void` | ` https://developer.android.com/reference/android/app/DialogFragment#onDismiss(android.content.DialogInterface)(https://developer.android.com/reference/android/content/DialogInterface dialog) ` This method will be invoked when the dialog is dismissed. |
| ` https://developer.android.com/reference/android/view/LayoutInflater` | ` https://developer.android.com/reference/android/app/DialogFragment#onGetLayoutInflater(android.os.Bundle)(https://developer.android.com/reference/android/os/Bundle savedInstanceState) ` Returns the LayoutInflater used to inflate Views of this Fragment. |
| ` void` | ` https://developer.android.com/reference/android/app/DialogFragment#onSaveInstanceState(android.os.Bundle)(https://developer.android.com/reference/android/os/Bundle outState) ` Called to ask the fragment to save its current dynamic state, so it can later be reconstructed in a new instance of its process is restarted. |
| ` void` | ` https://developer.android.com/reference/android/app/DialogFragment#onStart()() ` Called when the Fragment is visible to the user. |
| ` void` | ` https://developer.android.com/reference/android/app/DialogFragment#onStop()() ` Called when the Fragment is no longer started. |
| ` void` | ` https://developer.android.com/reference/android/app/DialogFragment#setCancelable(boolean)(boolean cancelable) ` Control whether the shown Dialog is cancelable. |
| ` void` | ` https://developer.android.com/reference/android/app/DialogFragment#setShowsDialog(boolean)(boolean showsDialog) ` Controls whether this fragment should be shown in a dialog. |
| ` void` | ` https://developer.android.com/reference/android/app/DialogFragment#setStyle(int,%20int)(int style, int theme) ` Call to customize the basic appearance and behavior of the fragment's dialog. |
| ` void` | ` https://developer.android.com/reference/android/app/DialogFragment#show(android.app.FragmentManager,%20java.lang.String)(https://developer.android.com/reference/android/app/FragmentManager manager, https://developer.android.com/reference/java/lang/String tag) ` Display the dialog, adding the fragment to the given FragmentManager. |
| ` int` | ` https://developer.android.com/reference/android/app/DialogFragment#show(android.app.FragmentTransaction,%20java.lang.String)(https://developer.android.com/reference/android/app/FragmentTransaction transaction, https://developer.android.com/reference/java/lang/String tag) ` Display the dialog, adding the fragment using an existing transaction and then committing the transaction. |

### Inherited methods

From class `

https://developer.android.com/reference/android/app/Fragment

` `


void` `
https://developer.android.com/reference/android/app/Fragment#dump(java.lang.String,%20java.io.FileDescriptor,%20java.io.PrintWriter,%20java.lang.String[])(https://developer.android.com/reference/java/lang/String prefix, https://developer.android.com/reference/java/io/FileDescriptor fd, https://developer.android.com/reference/java/io/PrintWriter writer, https://developer.android.com/reference/java/lang/String args)
`

Print the Fragments's state into the given stream.


`


final

boolean` `
https://developer.android.com/reference/android/app/Fragment#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object o)
`

Subclasses can not override equals().


`


final

https://developer.android.com/reference/android/app/Activity` `
https://developer.android.com/reference/android/app/Fragment#getActivity()()
`

Return the Activity this fragment is currently associated with.


`


boolean` `
https://developer.android.com/reference/android/app/Fragment#getAllowEnterTransitionOverlap()()
`

Returns whether the exit transition and enter transition overlap or not.


`


boolean` `
https://developer.android.com/reference/android/app/Fragment#getAllowReturnTransitionOverlap()()
`

Returns whether the return transition and reenter transition overlap or not.


`


final

https://developer.android.com/reference/android/os/Bundle` `
https://developer.android.com/reference/android/app/Fragment#getArguments()()
`

Return the arguments supplied to `https://developer.android.com/reference/android/app/Fragment#setArguments(android.os.Bundle)`, if any.


`


final

https://developer.android.com/reference/android/app/FragmentManager` `
https://developer.android.com/reference/android/app/Fragment#getChildFragmentManager()()
`

Return a private FragmentManager for placing and managing Fragments
inside of this Fragment.


`


https://developer.android.com/reference/android/content/Context` `
https://developer.android.com/reference/android/app/Fragment#getContext()()
`

Return the `https://developer.android.com/reference/android/content/Context` this fragment is currently associated with.


`


https://developer.android.com/reference/android/transition/Transition` `
https://developer.android.com/reference/android/app/Fragment#getEnterTransition()()
`

Returns the Transition that will be used to move Views into the initial scene.


`


https://developer.android.com/reference/android/transition/Transition` `
https://developer.android.com/reference/android/app/Fragment#getExitTransition()()
`

Returns the Transition that will be used to move Views out of the scene when the
fragment is removed, hidden, or detached when not popping the back stack.


`


final

https://developer.android.com/reference/android/app/FragmentManager` `
https://developer.android.com/reference/android/app/Fragment#getFragmentManager()()
`

Return the FragmentManager for interacting with fragments associated
with this fragment's activity.


`


final

https://developer.android.com/reference/java/lang/Object` `
https://developer.android.com/reference/android/app/Fragment#getHost()()
`

Return the host object of this fragment.


`


final

int` `
https://developer.android.com/reference/android/app/Fragment#getId()()
`

Return the identifier this fragment is known by.


`


final

https://developer.android.com/reference/android/view/LayoutInflater` `
https://developer.android.com/reference/android/app/Fragment#getLayoutInflater()()
`

Returns the cached LayoutInflater used to inflate Views of this Fragment.


`


https://developer.android.com/reference/android/app/LoaderManager` `
https://developer.android.com/reference/android/app/Fragment#getLoaderManager()()
`

*This method is deprecated.
Use `https://developer.android.com/reference/androidx/fragment/app/Fragment.html#getLoaderManager()`*


`


final

https://developer.android.com/reference/android/app/Fragment` `
https://developer.android.com/reference/android/app/Fragment#getParentFragment()()
`

Returns the parent Fragment containing this Fragment.


`


https://developer.android.com/reference/android/transition/Transition` `
https://developer.android.com/reference/android/app/Fragment#getReenterTransition()()
`

Returns the Transition that will be used to move Views in to the scene when returning due
to popping a back stack.


`


final

https://developer.android.com/reference/android/content/res/Resources` `
https://developer.android.com/reference/android/app/Fragment#getResources()()
`

Return `getActivity().getResources()`.


`


final

boolean` `
https://developer.android.com/reference/android/app/Fragment#getRetainInstance()()
` `


https://developer.android.com/reference/android/transition/Transition` `
https://developer.android.com/reference/android/app/Fragment#getReturnTransition()()
`

Returns the Transition that will be used to move Views out of the scene when the Fragment is
preparing to be removed, hidden, or detached because of popping the back stack.


`


https://developer.android.com/reference/android/transition/Transition` `
https://developer.android.com/reference/android/app/Fragment#getSharedElementEnterTransition()()
`

Returns the Transition that will be used for shared elements transferred into the content
Scene.


`


https://developer.android.com/reference/android/transition/Transition` `
https://developer.android.com/reference/android/app/Fragment#getSharedElementReturnTransition()()
`

Return the Transition that will be used for shared elements transferred back during a
pop of the back stack.


`


final

https://developer.android.com/reference/java/lang/String` `
https://developer.android.com/reference/android/app/Fragment#getString(int)(int resId)
`

Return a localized string from the application's package's
default string table.


`


final

https://developer.android.com/reference/java/lang/String` `
https://developer.android.com/reference/android/app/Fragment#getString(int,%20java.lang.Object[])(int resId, https://developer.android.com/reference/java/lang/Object formatArgs)
`

Return a localized formatted string from the application's package's
default string table, substituting the format arguments as defined in
`https://developer.android.com/reference/java/util/Formatter` and `https://developer.android.com/reference/java/lang/String#format(java.lang.String,%20java.lang.Object[])`.


`


final

https://developer.android.com/reference/java/lang/String` `
https://developer.android.com/reference/android/app/Fragment#getTag()()
`

Get the tag name of the fragment, if specified.


`


final

https://developer.android.com/reference/android/app/Fragment` `
https://developer.android.com/reference/android/app/Fragment#getTargetFragment()()
`

Return the target fragment set by `https://developer.android.com/reference/android/app/Fragment#setTargetFragment(android.app.Fragment,%20int)`.


`


final

int` `
https://developer.android.com/reference/android/app/Fragment#getTargetRequestCode()()
`

Return the target request code set by `https://developer.android.com/reference/android/app/Fragment#setTargetFragment(android.app.Fragment,%20int)`.


`


final

https://developer.android.com/reference/java/lang/CharSequence` `
https://developer.android.com/reference/android/app/Fragment#getText(int)(int resId)
`

Return a localized, styled CharSequence from the application's package's
default string table.


`


boolean` `
https://developer.android.com/reference/android/app/Fragment#getUserVisibleHint()()
` `


https://developer.android.com/reference/android/view/View` `
https://developer.android.com/reference/android/app/Fragment#getView()()
`

Get the root view for the fragment's layout (the one returned by `https://developer.android.com/reference/android/app/Fragment#onCreateView(android.view.LayoutInflater,%20android.view.ViewGroup,%20android.os.Bundle)`),
if provided.


`


final

int` `
https://developer.android.com/reference/android/app/Fragment#hashCode()()
`

Subclasses can not override hashCode().


`


static


https://developer.android.com/reference/android/app/Fragment` `
https://developer.android.com/reference/android/app/Fragment#instantiate(android.content.Context,%20java.lang.String)(https://developer.android.com/reference/android/content/Context context, https://developer.android.com/reference/java/lang/String fname)
`

Like `https://developer.android.com/reference/android/app/Fragment#instantiate(android.content.Context,%20java.lang.String,%20android.os.Bundle)` but with a null
argument Bundle.


`


static


https://developer.android.com/reference/android/app/Fragment` `
https://developer.android.com/reference/android/app/Fragment#instantiate(android.content.Context,%20java.lang.String,%20android.os.Bundle)(https://developer.android.com/reference/android/content/Context context, https://developer.android.com/reference/java/lang/String fname, https://developer.android.com/reference/android/os/Bundle args)
`

Create a new instance of a Fragment with the given class name.


`


final

boolean` `
https://developer.android.com/reference/android/app/Fragment#isAdded()()
`

Return true if the fragment is currently added to its activity.


`


final

boolean` `
https://developer.android.com/reference/android/app/Fragment#isDetached()()
`

Return true if the fragment has been explicitly detached from the UI.


`


final

boolean` `
https://developer.android.com/reference/android/app/Fragment#isHidden()()
`

Return true if the fragment has been hidden.


`


final

boolean` `
https://developer.android.com/reference/android/app/Fragment#isInLayout()()
`

Return true if the layout is included as part of an activity view
hierarchy via the \<fragment\> tag.


`


final

boolean` `
https://developer.android.com/reference/android/app/Fragment#isRemoving()()
`

Return true if this fragment is currently being removed from its
activity.


`


final

boolean` `
https://developer.android.com/reference/android/app/Fragment#isResumed()()
`

Return true if the fragment is in the resumed state.


`


final

boolean` `
https://developer.android.com/reference/android/app/Fragment#isStateSaved()()
`

Returns true if this fragment is added and its state has already been saved
by its host.


`


final

boolean` `
https://developer.android.com/reference/android/app/Fragment#isVisible()()
`

Return true if the fragment is currently visible to the user.


`


void` `
https://developer.android.com/reference/android/app/Fragment#onActivityCreated(android.os.Bundle)(https://developer.android.com/reference/android/os/Bundle savedInstanceState)
`

Called when the fragment's activity has been created and this
fragment's view hierarchy instantiated.


`


void` `
https://developer.android.com/reference/android/app/Fragment#onActivityResult(int,%20int,%20android.content.Intent)(int requestCode, int resultCode, https://developer.android.com/reference/android/content/Intent data)
`

Receive the result from a previous call to
`https://developer.android.com/reference/android/app/Fragment#startActivityForResult(android.content.Intent,%20int)`.


`


void` `
https://developer.android.com/reference/android/app/Fragment#onAttach(android.app.Activity)(https://developer.android.com/reference/android/app/Activity activity)
`

*This method was deprecated
in API level 23.
Use `https://developer.android.com/reference/android/app/Fragment#onAttach(android.content.Context)` instead.*


`


void` `
https://developer.android.com/reference/android/app/Fragment#onAttach(android.content.Context)(https://developer.android.com/reference/android/content/Context context)
`

Called when a fragment is first attached to its context.


`


void` `
https://developer.android.com/reference/android/app/Fragment#onAttachFragment(android.app.Fragment)(https://developer.android.com/reference/android/app/Fragment childFragment)
`

Called when a fragment is attached as a child of this fragment.


`


void` `
https://developer.android.com/reference/android/app/Fragment#onConfigurationChanged(android.content.res.Configuration)(https://developer.android.com/reference/android/content/res/Configuration newConfig)
`

Called by the system when the device configuration changes while your
component is running.

If you override this method you *must* call through to the
superclass implementation.


`


boolean` `
https://developer.android.com/reference/android/app/Fragment#onContextItemSelected(android.view.MenuItem)(https://developer.android.com/reference/android/view/MenuItem item)
`

This hook is called whenever an item in a context menu is selected.


`


void` `
https://developer.android.com/reference/android/app/Fragment#onCreate(android.os.Bundle)(https://developer.android.com/reference/android/os/Bundle savedInstanceState)
`

Called to do initial creation of a fragment.


`


https://developer.android.com/reference/android/animation/Animator` `
https://developer.android.com/reference/android/app/Fragment#onCreateAnimator(int,%20boolean,%20int)(int transit, boolean enter, int nextAnim)
`

Called when a fragment loads an animation.


`


void` `
https://developer.android.com/reference/android/app/Fragment#onCreateContextMenu(android.view.ContextMenu,%20android.view.View,%20android.view.ContextMenu.ContextMenuInfo)(https://developer.android.com/reference/android/view/ContextMenu menu, https://developer.android.com/reference/android/view/View v, https://developer.android.com/reference/android/view/ContextMenu.ContextMenuInfo menuInfo)
`

Called when a context menu for the `view` is about to be shown.


`


void` `
https://developer.android.com/reference/android/app/Fragment#onCreateOptionsMenu(android.view.Menu,%20android.view.MenuInflater)(https://developer.android.com/reference/android/view/Menu menu, https://developer.android.com/reference/android/view/MenuInflater inflater)
`

Initialize the contents of the Activity's standard options menu.


`


https://developer.android.com/reference/android/view/View` `
https://developer.android.com/reference/android/app/Fragment#onCreateView(android.view.LayoutInflater,%20android.view.ViewGroup,%20android.os.Bundle)(https://developer.android.com/reference/android/view/LayoutInflater inflater, https://developer.android.com/reference/android/view/ViewGroup container, https://developer.android.com/reference/android/os/Bundle savedInstanceState)
`

Called to have the fragment instantiate its user interface view.


`


void` `
https://developer.android.com/reference/android/app/Fragment#onDestroy()()
`

Called when the fragment is no longer in use.


`


void` `
https://developer.android.com/reference/android/app/Fragment#onDestroyOptionsMenu()()
`

Called when this fragment's option menu items are no longer being
included in the overall options menu.


`


void` `
https://developer.android.com/reference/android/app/Fragment#onDestroyView()()
`

Called when the view previously created by `https://developer.android.com/reference/android/app/Fragment#onCreateView(android.view.LayoutInflater,%20android.view.ViewGroup,%20android.os.Bundle)` has
been detached from the fragment.


`


void` `
https://developer.android.com/reference/android/app/Fragment#onDetach()()
`

Called when the fragment is no longer attached to its activity.


`


https://developer.android.com/reference/android/view/LayoutInflater` `
https://developer.android.com/reference/android/app/Fragment#onGetLayoutInflater(android.os.Bundle)(https://developer.android.com/reference/android/os/Bundle savedInstanceState)
`

Returns the LayoutInflater used to inflate Views of this Fragment.


`


void` `
https://developer.android.com/reference/android/app/Fragment#onHiddenChanged(boolean)(boolean hidden)
`

Called when the hidden state (as returned by `https://developer.android.com/reference/android/app/Fragment#isHidden()` of
the fragment has changed.


`


void` `
https://developer.android.com/reference/android/app/Fragment#onInflate(android.util.AttributeSet,%20android.os.Bundle)(https://developer.android.com/reference/android/util/AttributeSet attrs, https://developer.android.com/reference/android/os/Bundle savedInstanceState)
`

*This method was deprecated
in API level 15.
Use `https://developer.android.com/reference/android/app/Fragment#onInflate(android.content.Context,%20android.util.AttributeSet,%20android.os.Bundle)` instead.*


`


void` `
https://developer.android.com/reference/android/app/Fragment#onInflate(android.app.Activity,%20android.util.AttributeSet,%20android.os.Bundle)(https://developer.android.com/reference/android/app/Activity activity, https://developer.android.com/reference/android/util/AttributeSet attrs, https://developer.android.com/reference/android/os/Bundle savedInstanceState)
`

*This method was deprecated
in API level 23.
Use `https://developer.android.com/reference/android/app/Fragment#onInflate(android.content.Context,%20android.util.AttributeSet,%20android.os.Bundle)` instead.*


`


void` `
https://developer.android.com/reference/android/app/Fragment#onInflate(android.content.Context,%20android.util.AttributeSet,%20android.os.Bundle)(https://developer.android.com/reference/android/content/Context context, https://developer.android.com/reference/android/util/AttributeSet attrs, https://developer.android.com/reference/android/os/Bundle savedInstanceState)
`

Called when a fragment is being created as part of a view layout
inflation, typically from setting the content view of an activity.


`


void` `
https://developer.android.com/reference/android/app/Fragment#onLowMemory()()
`

This is called when the overall system is running low on memory, and
actively running processes should trim their memory usage.

If you override this method you *must* call through to the
superclass implementation.


`


void` `
https://developer.android.com/reference/android/app/Fragment#onMultiWindowModeChanged(boolean)(boolean isInMultiWindowMode)
`

*This method was deprecated
in API level 26.
Use `https://developer.android.com/reference/android/app/Fragment#onMultiWindowModeChanged(boolean,%20android.content.res.Configuration)` instead.*


`


void` `
https://developer.android.com/reference/android/app/Fragment#onMultiWindowModeChanged(boolean,%20android.content.res.Configuration)(boolean isInMultiWindowMode, https://developer.android.com/reference/android/content/res/Configuration newConfig)
`

Called when the Fragment's activity changes from fullscreen mode to multi-window mode and
visa-versa.


`


boolean` `
https://developer.android.com/reference/android/app/Fragment#onOptionsItemSelected(android.view.MenuItem)(https://developer.android.com/reference/android/view/MenuItem item)
`

This hook is called whenever an item in your options menu is selected.


`


void` `
https://developer.android.com/reference/android/app/Fragment#onOptionsMenuClosed(android.view.Menu)(https://developer.android.com/reference/android/view/Menu menu)
`

This hook is called whenever the options menu is being closed (either by the user canceling
the menu with the back/menu button, or when an item is selected).


`


void` `
https://developer.android.com/reference/android/app/Fragment#onPause()()
`

Called when the Fragment is no longer resumed.


`


void` `
https://developer.android.com/reference/android/app/Fragment#onPictureInPictureModeChanged(boolean,%20android.content.res.Configuration)(boolean isInPictureInPictureMode, https://developer.android.com/reference/android/content/res/Configuration newConfig)
`

Called by the system when the activity changes to and from picture-in-picture mode.


`


void` `
https://developer.android.com/reference/android/app/Fragment#onPictureInPictureModeChanged(boolean)(boolean isInPictureInPictureMode)
`

*This method was deprecated
in API level 26.
Use `https://developer.android.com/reference/android/app/Fragment#onPictureInPictureModeChanged(boolean,%20android.content.res.Configuration)` instead.*


`


void` `
https://developer.android.com/reference/android/app/Fragment#onPrepareOptionsMenu(android.view.Menu)(https://developer.android.com/reference/android/view/Menu menu)
`

Prepare the Screen's standard options menu to be displayed.


`


void` `
https://developer.android.com/reference/android/app/Fragment#onRequestPermissionsResult(int,%20java.lang.String[],%20int[])(int requestCode, https://developer.android.com/reference/java/lang/String permissions, int[] grantResults)
`

Callback for the result from requesting permissions.


`


void` `
https://developer.android.com/reference/android/app/Fragment#onResume()()
`

Called when the fragment is visible to the user and actively running.


`


void` `
https://developer.android.com/reference/android/app/Fragment#onSaveInstanceState(android.os.Bundle)(https://developer.android.com/reference/android/os/Bundle outState)
`

Called to ask the fragment to save its current dynamic state, so it
can later be reconstructed in a new instance of its process is
restarted.


`


void` `
https://developer.android.com/reference/android/app/Fragment#onStart()()
`

Called when the Fragment is visible to the user.


`


void` `
https://developer.android.com/reference/android/app/Fragment#onStop()()
`

Called when the Fragment is no longer started.


`


void` `
https://developer.android.com/reference/android/app/Fragment#onTrimMemory(int)(int level)
`

Called when the operating system has determined that it is a good
time for a process to trim unneeded memory from its process.

If you override this method you *must* call through to the
superclass implementation.


`


void` `
https://developer.android.com/reference/android/app/Fragment#onViewCreated(android.view.View,%20android.os.Bundle)(https://developer.android.com/reference/android/view/View view, https://developer.android.com/reference/android/os/Bundle savedInstanceState)
`

Called immediately after `https://developer.android.com/reference/android/app/Fragment#onCreateView(android.view.LayoutInflater,%20android.view.ViewGroup,%20android.os.Bundle)`
has returned, but before any saved state has been restored in to the view.


`


void` `
https://developer.android.com/reference/android/app/Fragment#onViewStateRestored(android.os.Bundle)(https://developer.android.com/reference/android/os/Bundle savedInstanceState)
`

Called when all saved state has been restored into the view hierarchy
of the fragment.


`


void` `
https://developer.android.com/reference/android/app/Fragment#postponeEnterTransition()()
`

Postpone the entering Fragment transition until `https://developer.android.com/reference/android/app/Fragment#startPostponedEnterTransition()`
or `https://developer.android.com/reference/android/app/FragmentManager#executePendingTransactions()` has been called.


`


void` `
https://developer.android.com/reference/android/app/Fragment#registerForContextMenu(android.view.View)(https://developer.android.com/reference/android/view/View view)
`

Registers a context menu to be shown for the given view (multiple views
can show the context menu).


`


final

void` `
https://developer.android.com/reference/android/app/Fragment#requestPermissions(java.lang.String[],%20int)(https://developer.android.com/reference/java/lang/String permissions, int requestCode)
`

Requests permissions to be granted to this application.


`


void` `
https://developer.android.com/reference/android/app/Fragment#setAllowEnterTransitionOverlap(boolean)(boolean allow)
`

Sets whether the exit transition and enter transition overlap or not.


`


void` `
https://developer.android.com/reference/android/app/Fragment#setAllowReturnTransitionOverlap(boolean)(boolean allow)
`

Sets whether the return transition and reenter transition overlap or not.


`


void` `
https://developer.android.com/reference/android/app/Fragment#setArguments(android.os.Bundle)(https://developer.android.com/reference/android/os/Bundle args)
`

Supply the construction arguments for this fragment.


`


void` `
https://developer.android.com/reference/android/app/Fragment#setEnterSharedElementCallback(android.app.SharedElementCallback)(https://developer.android.com/reference/android/app/SharedElementCallback callback)
`

When custom transitions are used with Fragments, the enter transition callback
is called when this Fragment is attached or detached when not popping the back stack.


`


void` `
https://developer.android.com/reference/android/app/Fragment#setEnterTransition(android.transition.Transition)(https://developer.android.com/reference/android/transition/Transition transition)
`

Sets the Transition that will be used to move Views into the initial scene.


`


void` `
https://developer.android.com/reference/android/app/Fragment#setExitSharedElementCallback(android.app.SharedElementCallback)(https://developer.android.com/reference/android/app/SharedElementCallback callback)
`

When custom transitions are used with Fragments, the exit transition callback
is called when this Fragment is attached or detached when popping the back stack.


`


void` `
https://developer.android.com/reference/android/app/Fragment#setExitTransition(android.transition.Transition)(https://developer.android.com/reference/android/transition/Transition transition)
`

Sets the Transition that will be used to move Views out of the scene when the
fragment is removed, hidden, or detached when not popping the back stack.


`


void` `
https://developer.android.com/reference/android/app/Fragment#setHasOptionsMenu(boolean)(boolean hasMenu)
`

Report that this fragment would like to participate in populating
the options menu by receiving a call to `https://developer.android.com/reference/android/app/Fragment#onCreateOptionsMenu(android.view.Menu,%20android.view.MenuInflater)`
and related methods.


`


void` `
https://developer.android.com/reference/android/app/Fragment#setInitialSavedState(android.app.Fragment.SavedState)(https://developer.android.com/reference/android/app/Fragment.SavedState state)
`

Set the initial saved state that this Fragment should restore itself
from when first being constructed, as returned by
`https://developer.android.com/reference/android/app/FragmentManager#saveFragmentInstanceState(android.app.Fragment)`.


`


void` `
https://developer.android.com/reference/android/app/Fragment#setMenuVisibility(boolean)(boolean menuVisible)
`

Set a hint for whether this fragment's menu should be visible.


`


void` `
https://developer.android.com/reference/android/app/Fragment#setReenterTransition(android.transition.Transition)(https://developer.android.com/reference/android/transition/Transition transition)
`

Sets the Transition that will be used to move Views in to the scene when returning due
to popping a back stack.


`


void` `
https://developer.android.com/reference/android/app/Fragment#setRetainInstance(boolean)(boolean retain)
`

Control whether a fragment instance is retained across Activity
re-creation (such as from a configuration change).


`


void` `
https://developer.android.com/reference/android/app/Fragment#setReturnTransition(android.transition.Transition)(https://developer.android.com/reference/android/transition/Transition transition)
`

Sets the Transition that will be used to move Views out of the scene when the Fragment is
preparing to be removed, hidden, or detached because of popping the back stack.


`


void` `
https://developer.android.com/reference/android/app/Fragment#setSharedElementEnterTransition(android.transition.Transition)(https://developer.android.com/reference/android/transition/Transition transition)
`

Sets the Transition that will be used for shared elements transferred into the content
Scene.


`


void` `
https://developer.android.com/reference/android/app/Fragment#setSharedElementReturnTransition(android.transition.Transition)(https://developer.android.com/reference/android/transition/Transition transition)
`

Sets the Transition that will be used for shared elements transferred back during a
pop of the back stack.


`


void` `
https://developer.android.com/reference/android/app/Fragment#setTargetFragment(android.app.Fragment,%20int)(https://developer.android.com/reference/android/app/Fragment fragment, int requestCode)
`

Optional target for this fragment.


`


void` `
https://developer.android.com/reference/android/app/Fragment#setUserVisibleHint(boolean)(boolean isVisibleToUser)
`

Set a hint to the system about whether this fragment's UI is currently visible
to the user.


`


boolean` `
https://developer.android.com/reference/android/app/Fragment#shouldShowRequestPermissionRationale(java.lang.String)(https://developer.android.com/reference/java/lang/String permission)
`

Gets whether you should show UI with rationale before requesting a permission.


`


void` `
https://developer.android.com/reference/android/app/Fragment#startActivity(android.content.Intent)(https://developer.android.com/reference/android/content/Intent intent)
`

Call `https://developer.android.com/reference/android/app/Activity#startActivity(android.content.Intent)` from the fragment's
containing Activity.


`


void` `
https://developer.android.com/reference/android/app/Fragment#startActivity(android.content.Intent,%20android.os.Bundle)(https://developer.android.com/reference/android/content/Intent intent, https://developer.android.com/reference/android/os/Bundle options)
`

Call `https://developer.android.com/reference/android/app/Activity#startActivity(android.content.Intent,%20android.os.Bundle)` from the fragment's
containing Activity.


`


void` `
https://developer.android.com/reference/android/app/Fragment#startActivityForResult(android.content.Intent,%20int)(https://developer.android.com/reference/android/content/Intent intent, int requestCode)
`

Call `https://developer.android.com/reference/android/app/Activity#startActivityForResult(android.content.Intent,%20int)` from the fragment's
containing Activity.


`


void` `
https://developer.android.com/reference/android/app/Fragment#startActivityForResult(android.content.Intent,%20int,%20android.os.Bundle)(https://developer.android.com/reference/android/content/Intent intent, int requestCode, https://developer.android.com/reference/android/os/Bundle options)
`

Call `https://developer.android.com/reference/android/app/Activity#startActivityForResult(android.content.Intent,%20int,%20android.os.Bundle)` from the fragment's
containing Activity.


`


void` `
https://developer.android.com/reference/android/app/Fragment#startIntentSenderForResult(android.content.IntentSender,%20int,%20android.content.Intent,%20int,%20int,%20int,%20android.os.Bundle)(https://developer.android.com/reference/android/content/IntentSender intent, int requestCode, https://developer.android.com/reference/android/content/Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags, https://developer.android.com/reference/android/os/Bundle options)
`

Call `https://developer.android.com/reference/android/app/Activity#startIntentSenderForResult(android.content.IntentSender,%20int,%20android.content.Intent,%20int,%20int,%20int,%20android.os.Bundle)` from the fragment's containing Activity.


`


void` `
https://developer.android.com/reference/android/app/Fragment#startPostponedEnterTransition()()
`

Begin postponed transitions after `https://developer.android.com/reference/android/app/Fragment#postponeEnterTransition()` was called.


`


https://developer.android.com/reference/java/lang/String` `
https://developer.android.com/reference/android/app/Fragment#toString()()
`

Returns a string representation of the object.


`


void` `
https://developer.android.com/reference/android/app/Fragment#unregisterForContextMenu(android.view.View)(https://developer.android.com/reference/android/view/View view)
`

Prevents a context menu to be shown for the given view.


From class `

https://developer.android.com/reference/java/lang/Object

` `


https://developer.android.com/reference/java/lang/Object` `
https://developer.android.com/reference/java/lang/Object#clone()()
`

Creates and returns a copy of this object.


`


boolean` `
https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj)
`

Indicates whether some other object is "equal to" this one.


`


void` `
https://developer.android.com/reference/java/lang/Object#finalize()()
`

Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.


`


final

https://developer.android.com/reference/java/lang/Class<?>` `
https://developer.android.com/reference/java/lang/Object#getClass()()
`

Returns the runtime class of this `Object`.


`


int` `
https://developer.android.com/reference/java/lang/Object#hashCode()()
`

Returns a hash code value for the object.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#notify()()
`

Wakes up a single thread that is waiting on this object's
monitor.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#notifyAll()()
`

Wakes up all threads that are waiting on this object's monitor.


`


https://developer.android.com/reference/java/lang/String` `
https://developer.android.com/reference/java/lang/Object#toString()()
`

Returns a string representation of the object.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos)
`

Causes the current thread to wait until it is awakened, typically
by being *notified* or *interrupted*, or until a
certain amount of real time has elapsed.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis)
`

Causes the current thread to wait until it is awakened, typically
by being *notified* or *interrupted*, or until a
certain amount of real time has elapsed.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#wait()()
`

Causes the current thread to wait until it is awakened, typically
by being *notified* or *interrupted*.


From interface `

https://developer.android.com/reference/android/content/ComponentCallbacks2

` `
abstract


void` `
https://developer.android.com/reference/android/content/ComponentCallbacks2#onTrimMemory(int)(int level)
`

Called when the operating system has determined that it is a good
time for a process to trim unneeded memory from its process.


From interface `

https://developer.android.com/reference/android/view/View.OnCreateContextMenuListener

` `
abstract


void` `
https://developer.android.com/reference/android/view/View.OnCreateContextMenuListener#onCreateContextMenu(android.view.ContextMenu,%20android.view.View,%20android.view.ContextMenu.ContextMenuInfo)(https://developer.android.com/reference/android/view/ContextMenu menu, https://developer.android.com/reference/android/view/View v, https://developer.android.com/reference/android/view/ContextMenu.ContextMenuInfo menuInfo)
`

Called when the context menu for this view is being built.


From interface `

https://developer.android.com/reference/android/content/DialogInterface.OnCancelListener

` `
abstract


void` `
https://developer.android.com/reference/android/content/DialogInterface.OnCancelListener#onCancel(android.content.DialogInterface)(https://developer.android.com/reference/android/content/DialogInterface dialog)
`

This method will be invoked when the dialog is canceled.


From interface `

https://developer.android.com/reference/android/content/DialogInterface.OnDismissListener

` `
abstract


void` `
https://developer.android.com/reference/android/content/DialogInterface.OnDismissListener#onDismiss(android.content.DialogInterface)(https://developer.android.com/reference/android/content/DialogInterface dialog)
`

This method will be invoked when the dialog is dismissed.


From interface `

https://developer.android.com/reference/android/content/ComponentCallbacks

` `
abstract


void` `
https://developer.android.com/reference/android/content/ComponentCallbacks#onConfigurationChanged(android.content.res.Configuration)(https://developer.android.com/reference/android/content/res/Configuration newConfig)
`

Called by the system when the device configuration changes while your
component is running.


`
abstract


void` `
https://developer.android.com/reference/android/content/ComponentCallbacks#onLowMemory()()
`

*This method was deprecated
in API level 35.
Since API level 14 this is superseded by
`https://developer.android.com/reference/android/content/ComponentCallbacks2#onTrimMemory(int)`.
Since API level 34 this is never called.
If you're overriding ComponentCallbacks2#onTrimMemory and
your minSdkVersion is greater than API 14, you can provide
an empty implementation for this method.*


## Constants

### STYLE_NORMAL

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int STYLE_NORMAL
```

Style for `https://developer.android.com/reference/android/app/DialogFragment#setStyle(int,%20int)`: a basic,
normal dialog.

<br />

Constant Value:

0
(0x00000000)


### STYLE_NO_FRAME

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int STYLE_NO_FRAME
```

Style for `https://developer.android.com/reference/android/app/DialogFragment#setStyle(int,%20int)`: don't draw
any frame at all; the view hierarchy returned by `https://developer.android.com/reference/android/app/Fragment#onCreateView(android.view.LayoutInflater,%20android.view.ViewGroup,%20android.os.Bundle)`
is entirely responsible for drawing the dialog.

<br />

Constant Value:

2
(0x00000002)


### STYLE_NO_INPUT

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int STYLE_NO_INPUT
```

Style for `https://developer.android.com/reference/android/app/DialogFragment#setStyle(int,%20int)`: like
`https://developer.android.com/reference/android/app/DialogFragment#STYLE_NO_FRAME`, but also disables all input to the dialog.
The user can not touch it, and its window will not receive input focus.

<br />

Constant Value:

3
(0x00000003)


### STYLE_NO_TITLE

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int STYLE_NO_TITLE
```

Style for `https://developer.android.com/reference/android/app/DialogFragment#setStyle(int,%20int)`: don't include
a title area.

<br />

Constant Value:

1
(0x00000001)


## Public constructors

### DialogFragment

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public DialogFragment ()
```

<br />

<br />

## Public methods

### dismiss

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void dismiss ()
```

Dismiss the fragment and its dialog. If the fragment was added to the
back stack, all back stack state up to and including this entry will
be popped. Otherwise, a new transaction will be committed to remove
the fragment.

<br />

### dismissAllowingStateLoss

Added in [API level 12](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void dismissAllowingStateLoss ()
```

Version of `https://developer.android.com/reference/android/app/DialogFragment#dismiss()` that uses
`https://developer.android.com/reference/android/app/FragmentTransaction#commitAllowingStateLoss()`. See linked
documentation for further details.

<br />

### dump

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void dump (String prefix, 
                FileDescriptor fd, 
                PrintWriter writer, 
                String[] args)
```

Print the Fragments's state into the given stream.

<br />

| Parameters ||
|---|---|
| `prefix` | `String`: Text to print at the front of each line. <br /> |
| `fd` | `FileDescriptor`: The raw file descriptor that the dump is being sent to. <br /> |
| `writer` | `PrintWriter`: The PrintWriter to which you should dump your state. This will be closed for you after you return. <br /> |
| `args` | `String`: additional arguments to the dump request. <br /> |

### getDialog

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Dialog getDialog ()
```

<br />

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/app/Dialog` | <br /> |

### getShowsDialog

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean getShowsDialog ()
```

Return the current value of `https://developer.android.com/reference/android/app/DialogFragment#setShowsDialog(boolean)`.

<br />

| Returns ||
|---|---|
| `boolean` | <br /> |

### getTheme

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int getTheme ()
```

<br />

<br />

| Returns ||
|---|---|
| `int` | <br /> |

### isCancelable

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean isCancelable ()
```

Return the current value of `https://developer.android.com/reference/android/app/DialogFragment#setCancelable(boolean)`.

<br />

| Returns ||
|---|---|
| `boolean` | <br /> |

### onActivityCreated

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void onActivityCreated (Bundle savedInstanceState)
```

Called when the fragment's activity has been created and this
fragment's view hierarchy instantiated. It can be used to do final
initialization once these pieces are in place, such as retrieving
views or restoring state. It is also useful for fragments that use
`https://developer.android.com/reference/android/app/Fragment#setRetainInstance(boolean)` to retain their instance,
as this callback tells the fragment when it is fully associated with
the new activity instance. This is called after `https://developer.android.com/reference/android/app/Fragment#onCreateView(android.view.LayoutInflater,%20android.view.ViewGroup,%20android.os.Bundle)`
and before `https://developer.android.com/reference/android/app/Fragment#onViewStateRestored(android.os.Bundle)`.


If you override this method you *must* call through to the
superclass implementation.

<br />

| Parameters ||
|---|---|
| `savedInstanceState` | `Bundle`: If the fragment is being re-created from a previous saved state, this is the state. This value may be `null`. <br /> |

### onAttach

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void onAttach (Context context)
```

Called when a fragment is first attached to its context.
`https://developer.android.com/reference/android/app/Fragment#onCreate(android.os.Bundle)` will be called after this.


If you override this method you *must* call through to the
superclass implementation.

<br />

| Parameters ||
|---|---|
| `context` | `Context` <br /> |

### onCancel

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void onCancel (DialogInterface dialog)
```

This method will be invoked when the dialog is canceled.

<br />

| Parameters ||
|---|---|
| `dialog` | `DialogInterface`: the dialog that was canceled will be passed into the method <br /> |

### onCreate

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void onCreate (Bundle savedInstanceState)
```

Called to do initial creation of a fragment. This is called after
`https://developer.android.com/reference/android/app/Fragment#onAttach(android.app.Activity)` and before
`https://developer.android.com/reference/android/app/Fragment#onCreateView(android.view.LayoutInflater,%20android.view.ViewGroup,%20android.os.Bundle)`, but is not called if the fragment
instance is retained across Activity re-creation (see `https://developer.android.com/reference/android/app/Fragment#setRetainInstance(boolean)`).

Note that this can be called while the fragment's activity is
still in the process of being created. As such, you can not rely
on things like the activity's content view hierarchy being initialized
at this point. If you want to do work once the activity itself is
created, see `https://developer.android.com/reference/android/app/Fragment#onActivityCreated(android.os.Bundle)`.

If your app's `targetSdkVersion` is `https://developer.android.com/reference/android/os/Build.VERSION_CODES#M`
or lower, child fragments being restored from the savedInstanceState are restored after
`onCreate` returns. When targeting `https://developer.android.com/reference/android/os/Build.VERSION_CODES#N` or
above and running on an N or newer platform version
they are restored by `Fragment.onCreate`.
.   
If you override this method you *must* call through to the superclass implementation.

<br />

<br />

| Parameters ||
|---|---|
| `savedInstanceState` | `Bundle`: If the fragment is being re-created from a previous saved state, this is the state. This value may be `null`. <br /> |

### onCreateDialog

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public 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,
`https://developer.android.com/reference/android/app/Fragment#onCreateView(android.view.LayoutInflater,%20android.view.ViewGroup,%20android.os.Bundle)` does not need
to be implemented since the AlertDialog takes care of its own content.

This method will be called after `https://developer.android.com/reference/android/app/DialogFragment#onCreate(android.os.Bundle)` and
before `https://developer.android.com/reference/android/app/Fragment#onCreateView(android.view.LayoutInflater,%20android.view.ViewGroup,%20android.os.Bundle)`. The
default implementation simply instantiates and returns a `https://developer.android.com/reference/android/app/Dialog`
class.

*Note: DialogFragment own the `https://developer.android.com/reference/android/app/Dialog#setOnCancelListener(android.content.DialogInterface.OnCancelListener)` and `https://developer.android.com/reference/android/app/Dialog#setOnDismissListener(android.content.DialogInterface.OnDismissListener)` callbacks. You must not set them yourself.*
To find out about these events, override `https://developer.android.com/reference/android/app/DialogFragment#onCancel(android.content.DialogInterface)`
and `https://developer.android.com/reference/android/app/DialogFragment#onDismiss(android.content.DialogInterface)`.

<br />

<br />

| Parameters ||
|---|---|
| `savedInstanceState` | `Bundle`: The last saved instance state of the Fragment, or null if this is a freshly created Fragment. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/app/Dialog` | Return a new Dialog instance to be displayed by the Fragment. <br /> |

### onDestroyView

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void onDestroyView ()
```

Remove dialog.

<br />

### onDetach

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void onDetach ()
```

Called when the fragment is no longer attached to its activity. This is called after
`https://developer.android.com/reference/android/app/Fragment#onDestroy()`, except in the cases where the fragment instance is retained across
Activity re-creation (see `https://developer.android.com/reference/android/app/Fragment#setRetainInstance(boolean)`), in which case it is called
after `https://developer.android.com/reference/android/app/Fragment#onStop()`.


If you override this method you *must* call through to the
superclass implementation.

<br />

### onDismiss

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void onDismiss (DialogInterface dialog)
```

This method will be invoked when the dialog is dismissed.

<br />

| Parameters ||
|---|---|
| `dialog` | `DialogInterface`: the dialog that was dismissed will be passed into the method <br /> |

### onGetLayoutInflater

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public LayoutInflater onGetLayoutInflater (Bundle savedInstanceState)
```

Returns the LayoutInflater used to inflate Views of this Fragment. The default
implementation will throw an exception if the Fragment is not attached.

<br />

| Parameters ||
|---|---|
| `savedInstanceState` | `Bundle` <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/view/LayoutInflater` | The LayoutInflater used to inflate Views of this Fragment. <br /> |

### onSaveInstanceState

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void onSaveInstanceState (Bundle outState)
```

Called to ask the fragment to save its current dynamic state, so it
can later be reconstructed in a new instance of its process is
restarted. If a new instance of the fragment later needs to be
created, the data you place in the Bundle here will be available
in the Bundle given to `https://developer.android.com/reference/android/app/Fragment#onCreate(android.os.Bundle)`,
`https://developer.android.com/reference/android/app/Fragment#onCreateView(android.view.LayoutInflater,%20android.view.ViewGroup,%20android.os.Bundle)`, and
`https://developer.android.com/reference/android/app/Fragment#onActivityCreated(android.os.Bundle)`.

This corresponds to `https://developer.android.com/reference/android/app/Activity#onSaveInstanceState(android.os.Bundle)` and most of the discussion there
applies here as well. Note however: *this method may be called
at any time before `https://developer.android.com/reference/android/app/Fragment#onDestroy()`*. There are many situations
where a fragment may be mostly torn down (such as when placed on the
back stack with no UI showing), but its state will not be saved until
its owning activity actually needs to save its state.

<br />

| Parameters ||
|---|---|
| `outState` | `Bundle`: Bundle in which to place your saved state. <br /> |

### onStart

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void onStart ()
```

Called when the Fragment is visible to the user. This is generally
tied to `https://developer.android.com/reference/android/app/Activity#onStart()` of the containing
Activity's lifecycle.


If you override this method you *must* call through to the
superclass implementation.

<br />

### onStop

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void onStop ()
```

Called when the Fragment is no longer started. This is generally
tied to `https://developer.android.com/reference/android/app/Activity#onStop()` of the containing
Activity's lifecycle.


If you override this method you *must* call through to the
superclass implementation.

<br />

### setCancelable

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setCancelable (boolean cancelable)
```

Control whether the shown Dialog is cancelable. Use this instead of
directly calling `https://developer.android.com/reference/android/app/Dialog#setCancelable(boolean)`, because DialogFragment needs to change
its behavior based on this.

<br />

| Parameters ||
|---|---|
| `cancelable` | `boolean`: If true, the dialog is cancelable. The default is true. <br /> |

### setShowsDialog

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setShowsDialog (boolean showsDialog)
```

Controls whether this fragment should be shown in a dialog. If not
set, no Dialog will be created in `https://developer.android.com/reference/android/app/DialogFragment#onActivityCreated(android.os.Bundle)`,
and the fragment's view hierarchy will thus not be added to it. This
allows you to instead use it as a normal fragment (embedded inside of
its activity).

This is normally set for you based on whether the fragment is
associated with a container view ID passed to
`https://developer.android.com/reference/android/app/FragmentTransaction#add(int,%20android.app.Fragment)`.
If the fragment was added with a container, setShowsDialog will be
initialized to false; otherwise, it will be true.

<br />

| Parameters ||
|---|---|
| `showsDialog` | `boolean`: If true, the fragment will be displayed in a Dialog. If false, no Dialog will be created and the fragment's view hierarchly left undisturbed. <br /> |

### setStyle

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setStyle (int style, 
                int theme)
```

Call to customize the basic appearance and behavior of the
fragment's dialog. This can be used for some common dialog behaviors,
taking care of selecting flags, theme, and other options for you. The
same effect can be achieve by manually setting Dialog and Window
attributes yourself. Calling this after the fragment's Dialog is
created will have no effect.

<br />

| Parameters ||
|---|---|
| `style` | `int`: Selects a standard style: may be `https://developer.android.com/reference/android/app/DialogFragment#STYLE_NORMAL`, `https://developer.android.com/reference/android/app/DialogFragment#STYLE_NO_TITLE`, `https://developer.android.com/reference/android/app/DialogFragment#STYLE_NO_FRAME`, or `https://developer.android.com/reference/android/app/DialogFragment#STYLE_NO_INPUT`. <br /> |
| `theme` | `int`: Optional custom theme. If 0, an appropriate theme (based on the style) will be selected for you. <br /> |

### show

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void show (FragmentManager manager, 
                String tag)
```

Display the dialog, adding the fragment to the given FragmentManager. This
is a convenience for explicitly creating a transaction, adding the
fragment to it with the given tag, and committing it. This does
*not* add the transaction to the back stack. When the fragment
is dismissed, a new transaction will be executed to remove it from
the activity.

<br />

| Parameters ||
|---|---|
| `manager` | `FragmentManager`: The FragmentManager this fragment will be added to. <br /> |
| `tag` | `String`: The tag for this fragment, as per `https://developer.android.com/reference/android/app/FragmentTransaction#add(android.app.Fragment,%20java.lang.String)`. <br /> |

### show

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int show (FragmentTransaction transaction, 
                String tag)
```

Display the dialog, adding the fragment using an existing transaction
and then committing the transaction.

<br />

| Parameters ||
|---|---|
| `transaction` | `FragmentTransaction`: An existing transaction in which to add the fragment. <br /> |
| `tag` | `String`: The tag for this fragment, as per `https://developer.android.com/reference/android/app/FragmentTransaction#add(android.app.Fragment,%20java.lang.String)`. <br /> |

| Returns ||
|---|---|
| `int` | Returns the identifier of the committed transaction, as per `https://developer.android.com/reference/android/app/FragmentTransaction#commit()`. <br /> |