# DialogFragment

Artifact: [androidx.fragment:fragment](https://developer.android.com/jetpack/androidx/releases/fragment) [View Source](https://cs.android.com/search?q=file:androidx/fragment/app/DialogFragment.java+class:androidx.fragment.app.DialogFragment) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

*** ** * ** ***


```
class DialogFragment : Fragment, DialogInterface.OnCancelListener, DialogInterface.OnDismissListener
```

<br />

|---|---|---|
| [kotlin.Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html) |||
| ↳ | [androidx.fragment.app.Fragment](https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment) ||
|   | ↳ | [androidx.fragment.app.DialogFragment](https://developer.android.com/reference/kotlin/androidx/fragment/app/DialogFragment) |

Known direct subclasses [AppCompatDialogFragment](https://developer.android.com/reference/kotlin/androidx/appcompat/app/AppCompatDialogFragment), [MediaRouteChooserDialogFragment](https://developer.android.com/reference/kotlin/androidx/mediarouter/app/MediaRouteChooserDialogFragment), [MediaRouteControllerDialogFragment](https://developer.android.com/reference/kotlin/androidx/mediarouter/app/MediaRouteControllerDialogFragment), [PreferenceDialogFragmentCompat](https://developer.android.com/reference/kotlin/androidx/preference/PreferenceDialogFragmentCompat)

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/appcompat/app/AppCompatDialogFragment` | A special version of `https://developer.android.com/reference/kotlin/androidx/fragment/app/DialogFragment` which uses an `https://developer.android.com/reference/kotlin/androidx/appcompat/app/AppCompatDialog` in place of a platform-styled dialog. |
| `https://developer.android.com/reference/kotlin/androidx/mediarouter/app/MediaRouteChooserDialogFragment` | Media route chooser dialog fragment. |
| `https://developer.android.com/reference/kotlin/androidx/mediarouter/app/MediaRouteControllerDialogFragment` | Media route controller dialog fragment. |
| `https://developer.android.com/reference/kotlin/androidx/preference/PreferenceDialogFragmentCompat` | Abstract base class which presents a dialog associated with a `https://developer.android.com/reference/kotlin/androidx/preference/DialogPreference`. |

Known indirect subclasses [EditTextPreferenceDialogFragmentCompat](https://developer.android.com/reference/kotlin/androidx/preference/EditTextPreferenceDialogFragmentCompat), [ListPreferenceDialogFragmentCompat](https://developer.android.com/reference/kotlin/androidx/preference/ListPreferenceDialogFragmentCompat), [MultiSelectListPreferenceDialogFragmentCompat](https://developer.android.com/reference/kotlin/androidx/preference/MultiSelectListPreferenceDialogFragmentCompat)

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/preference/EditTextPreferenceDialogFragmentCompat` |   |
| `https://developer.android.com/reference/kotlin/androidx/preference/ListPreferenceDialogFragmentCompat` |   |
| `https://developer.android.com/reference/kotlin/androidx/preference/MultiSelectListPreferenceDialogFragmentCompat` |   |

*** ** * ** ***

A fragment that displays a dialog window, floating in the foreground 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 APIs here, not with direct calls on the dialog.

Implementations should override this class and implement `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#onViewCreated(android.view.View,android.os.Bundle)` to supply the content of the dialog. Alternatively, they can override `https://developer.android.com/reference/kotlin/androidx/fragment/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/kotlin/androidx/fragment/app/DialogFragment#Lifecycle)
2. [Basic Dialog](https://developer.android.com/reference/kotlin/androidx/fragment/app/DialogFragment#BasicDialog)
3. [Alert Dialog](https://developer.android.com/reference/kotlin/androidx/fragment/app/DialogFragment#AlertDialog)
4. [Selecting Between Dialog or Embedding](https://developer.android.com/reference/kotlin/androidx/fragment/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/kotlin/androidx/fragment/app/DialogFragment#show(androidx.fragment.app.FragmentManager,java.lang.String)`, `https://developer.android.com/reference/kotlin/androidx/fragment/app/DialogFragment#show(androidx.fragment.app.FragmentTransaction,java.lang.String)`, or `https://developer.android.com/reference/kotlin/androidx/fragment/app/DialogFragment#showNow(androidx.fragment.app.FragmentManager,java.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:

```kotlin
public 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) {
        return inflater.inflate(R.layout.fragment_dialog, container, false);
    }

    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);

        // set DialogFragment title
        getDialog().setTitle("Dialog #" + mNum);
    }
}
```

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

```kotlin
public 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 = getSupportFragmentManager().beginTransaction();
    Fragment prev = getSupportFragmentManager().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 that is dismissed separately from it.

### Alert Dialog

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

This is most useful for creating an AlertDialog, allowing you to display standard alerts to the user that are managed by a fragment. A simple example implementation of this is:

```kotlin
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(@Nullable Bundle savedInstanceState) {

        return new AlertDialog.Builder(getActivity())
                .setIcon(R.drawable.alert_dialog_icon)
                .setTitle(title)
                .setPositiveButton(R.string.alert_dialog_ok,
                        (dialogInterface, i) -> ((MainActivity)getActivity()).doPositiveClick())
                .setNegativeButton(R.string.alert_dialog_cancel,
                        (dialogInterface, i) -> ((MainActivity)getActivity()).doNegativeClick())
                .create();
        return super.onCreateDialog(savedInstanceState);
    }
}
```

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

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

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

public void doNegativeClick() {
    // Do stuff here.
    Log.i("MainActivity", "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/kotlin/androidx/fragment/app/DialogFragment#setShowsDialog(boolean)`.

For example, here is a simple dialog fragment:

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

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        // this fragment will be displayed in a dialog
        setShowsDialog(true);
    }

    @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:

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

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

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

## Summary

| ### Constants |
|---|---|
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/fragment/app/DialogFragment#STYLE_NORMAL() = 0` Style for `https://developer.android.com/reference/kotlin/androidx/fragment/app/DialogFragment#setStyle(int,int)`: a basic, normal dialog. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/fragment/app/DialogFragment#STYLE_NO_FRAME() = 2` Style for `https://developer.android.com/reference/kotlin/androidx/fragment/app/DialogFragment#setStyle(int,int)`: don't draw any frame at all; the view hierarchy returned by `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#onCreateView(android.view.LayoutInflater,android.view.ViewGroup,android.os.Bundle)` is entirely responsible for drawing the dialog. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/fragment/app/DialogFragment#STYLE_NO_INPUT() = 3` Style for `https://developer.android.com/reference/kotlin/androidx/fragment/app/DialogFragment#setStyle(int,int)`: like `https://developer.android.com/reference/kotlin/androidx/fragment/app/DialogFragment#STYLE_NO_FRAME()`, but also disables all input to the dialog. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/fragment/app/DialogFragment#STYLE_NO_TITLE() = 1` Style for `https://developer.android.com/reference/kotlin/androidx/fragment/app/DialogFragment#setStyle(int,int)`: don't include a title area. |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/fragment/app/DialogFragment#DialogFragment()()` Constructor used by the default `https://developer.android.com/reference/kotlin/androidx/fragment/app/FragmentFactory`. |
| `https://developer.android.com/reference/kotlin/androidx/fragment/app/DialogFragment#DialogFragment(int)(contentLayoutId: @https://developer.android.com/reference/kotlin/androidx/annotation/LayoutRes https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Alternate constructor that can be called from your default, no argument constructor to provide a default layout that will be inflated by `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#onCreateView(android.view.LayoutInflater,android.view.ViewGroup,android.os.Bundle)`. |

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/fragment/app/DialogFragment#dismiss()()` Dismiss the fragment and its dialog. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/fragment/app/DialogFragment#dismissAllowingStateLoss()()` Version of `https://developer.android.com/reference/kotlin/androidx/fragment/app/DialogFragment#dismiss()` that uses `https://developer.android.com/reference/kotlin/androidx/fragment/app/FragmentTransaction#commitAllowingStateLoss()`. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread https://developer.android.com/reference/kotlin/androidx/fragment/app/DialogFragment#dismissNow()()` Version of `https://developer.android.com/reference/kotlin/androidx/fragment/app/DialogFragment#dismiss()` that uses `https://developer.android.com/reference/kotlin/androidx/fragment/app/FragmentTransaction#commitNow()`. |
| `https://developer.android.com/reference/android/app/Dialog.html?` | `https://developer.android.com/reference/kotlin/androidx/fragment/app/DialogFragment#getDialog()()` Return the `https://developer.android.com/reference/android/app/Dialog.html` this fragment is currently controlling. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/fragment/app/DialogFragment#getShowsDialog()()` Return the current value of `https://developer.android.com/reference/kotlin/androidx/fragment/app/DialogFragment#setShowsDialog(boolean)`. |
| `@https://developer.android.com/reference/kotlin/androidx/annotation/StyleRes https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/fragment/app/DialogFragment#getTheme()()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/fragment/app/DialogFragment#isCancelable()()` Return the current value of `https://developer.android.com/reference/kotlin/androidx/fragment/app/DialogFragment#setCancelable(boolean)`. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread [onActivityCreated](https://developer.android.com/reference/kotlin/androidx/fragment/app/DialogFragment#onActivityCreated(android.os.Bundle))(savedInstanceState: https://developer.android.com/reference/android/os/Bundle.html?)` **This function is deprecated.** use `https://developer.android.com/reference/kotlin/androidx/fragment/app/DialogFragment#onCreateDialog(android.os.Bundle)` for code touching the dialog created by `https://developer.android.com/reference/kotlin/androidx/fragment/app/DialogFragment#onCreateDialog(android.os.Bundle)`, `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#onViewCreated(android.view.View,android.os.Bundle)` for code touching the view created by `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#onCreateView(android.view.LayoutInflater,android.view.ViewGroup,android.os.Bundle)` and `https://developer.android.com/reference/kotlin/androidx/fragment/app/DialogFragment#onCreate(android.os.Bundle)` for other initialization. <br /> |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread https://developer.android.com/reference/kotlin/androidx/fragment/app/DialogFragment#onAttach(android.content.Context)(context: https://developer.android.com/reference/android/content/Context.html)` Called when a fragment is first attached to its context. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/fragment/app/DialogFragment#onCancel(android.content.DialogInterface)(dialog: https://developer.android.com/reference/android/content/DialogInterface.html)` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread https://developer.android.com/reference/kotlin/androidx/fragment/app/DialogFragment#onCreate(android.os.Bundle)(savedInstanceState: https://developer.android.com/reference/android/os/Bundle.html?)` Called to do initial creation of a fragment. |
| `https://developer.android.com/reference/android/app/Dialog.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread https://developer.android.com/reference/kotlin/androidx/fragment/app/DialogFragment#onCreateDialog(android.os.Bundle)(savedInstanceState: https://developer.android.com/reference/android/os/Bundle.html?)` Override to build your own custom Dialog container. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread https://developer.android.com/reference/kotlin/androidx/fragment/app/DialogFragment#onDestroyView()()` Remove dialog. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread https://developer.android.com/reference/kotlin/androidx/fragment/app/DialogFragment#onDetach()()` Called when the fragment is no longer attached to its activity. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/CallSuper https://developer.android.com/reference/kotlin/androidx/fragment/app/DialogFragment#onDismiss(android.content.DialogInterface)(dialog: https://developer.android.com/reference/android/content/DialogInterface.html)` |
| `https://developer.android.com/reference/android/view/LayoutInflater.html` | `https://developer.android.com/reference/kotlin/androidx/fragment/app/DialogFragment#onGetLayoutInflater(android.os.Bundle)(savedInstanceState: https://developer.android.com/reference/android/os/Bundle.html?)` Returns the LayoutInflater used to inflate Views of this Fragment. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread https://developer.android.com/reference/kotlin/androidx/fragment/app/DialogFragment#onSaveInstanceState(android.os.Bundle)(outState: https://developer.android.com/reference/android/os/Bundle.html)` Called to ask the fragment to save its current dynamic state, so it can later be reconstructed in a new instance if its process is restarted. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread https://developer.android.com/reference/kotlin/androidx/fragment/app/DialogFragment#onStart()()` Called when the Fragment is visible to the user. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread https://developer.android.com/reference/kotlin/androidx/fragment/app/DialogFragment#onStop()()` Called when the Fragment is no longer started. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread https://developer.android.com/reference/kotlin/androidx/fragment/app/DialogFragment#onViewStateRestored(android.os.Bundle)(savedInstanceState: https://developer.android.com/reference/android/os/Bundle.html?)` Called when all saved state has been restored into the view hierarchy of the fragment. |
| `https://developer.android.com/reference/kotlin/androidx/activity/ComponentDialog` | `https://developer.android.com/reference/kotlin/androidx/fragment/app/DialogFragment#requireComponentDialog()()` Return the `https://developer.android.com/reference/kotlin/androidx/activity/ComponentDialog` this fragment is currently controlling. |
| `https://developer.android.com/reference/android/app/Dialog.html` | `https://developer.android.com/reference/kotlin/androidx/fragment/app/DialogFragment#requireDialog()()` Return the `https://developer.android.com/reference/android/app/Dialog.html` this fragment is currently controlling. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/fragment/app/DialogFragment#setCancelable(boolean)(cancelable: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Control whether the shown Dialog is cancelable. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/fragment/app/DialogFragment#setShowsDialog(boolean)(showsDialog: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Controls whether this fragment should be shown in a dialog. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/fragment/app/DialogFragment#setStyle(int,int)(style: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, theme: @https://developer.android.com/reference/kotlin/androidx/annotation/StyleRes https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Call to customize the basic appearance and behavior of the fragment's dialog. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/fragment/app/DialogFragment#show(androidx.fragment.app.FragmentManager,java.lang.String)(manager: https://developer.android.com/reference/kotlin/androidx/fragment/app/FragmentManager, tag: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?)` Display the dialog, adding the fragment to the given FragmentManager. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/fragment/app/DialogFragment#show(androidx.fragment.app.FragmentTransaction,java.lang.String)(transaction: https://developer.android.com/reference/kotlin/androidx/fragment/app/FragmentTransaction, tag: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?)` Display the dialog, adding the fragment using an existing transaction and then `https://developer.android.com/reference/kotlin/androidx/fragment/app/FragmentTransaction#commit()` the transaction. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/fragment/app/DialogFragment#showNow(androidx.fragment.app.FragmentManager,java.lang.String)(manager: https://developer.android.com/reference/kotlin/androidx/fragment/app/FragmentManager, tag: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?)` Display the dialog, immediately adding the fragment to the given FragmentManager. |

### Inherited functions

From [androidx.activity.result.ActivityResultCaller](https://developer.android.com/reference/kotlin/androidx/activity/result/ActivityResultCaller) `abstract https://developer.android.com/reference/kotlin/androidx/activity/result/ActivityResultLauncher<I!>!` `<I, O> https://developer.android.com/reference/kotlin/androidx/activity/result/ActivityResultCaller#registerForActivityResult(androidx.activity.result.contract.ActivityResultContract<I,O>,androidx.activity.result.ActivityResultCallback<O>)(
contract: https://developer.android.com/reference/kotlin/androidx/activity/result/contract/ActivityResultContract<I!, O!>!,
callback: https://developer.android.com/reference/kotlin/androidx/activity/result/ActivityResultCallback<O!>!
)`

Register a request to `https://developer.android.com/reference/android/app/Activity.html#startActivityForResult(android.content.Intent, int)`, designated by the given `https://developer.android.com/reference/kotlin/androidx/activity/result/contract/ActivityResultContract`.
From [android.content.ComponentCallbacks](https://developer.android.com/reference/android/content/ComponentCallbacks.html) `abstract https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/android/content/ComponentCallbacks.html#onConfigurationChanged(android.content.res.Configuration)(p: https://developer.android.com/reference/android/content/res/Configuration.html!)` `abstract https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/android/content/ComponentCallbacks.html#onLowMemory()()`

**This function is deprecated.**
From [androidx.activity.contextaware.ContextAware](https://developer.android.com/reference/kotlin/androidx/activity/contextaware/ContextAware) `abstract https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/activity/contextaware/ContextAware#addOnContextAvailableListener(androidx.activity.contextaware.OnContextAvailableListener)(listener: https://developer.android.com/reference/kotlin/androidx/activity/contextaware/OnContextAvailableListener!)`

Add a new `https://developer.android.com/reference/kotlin/androidx/activity/contextaware/OnContextAvailableListener` for receiving a callback for when this class is associated with a `https://developer.android.com/reference/android/content/Context.html`.
`abstract https://developer.android.com/reference/android/content/Context.html!` `https://developer.android.com/reference/kotlin/androidx/activity/contextaware/ContextAware#peekAvailableContext()()`

Get the `https://developer.android.com/reference/android/content/Context.html` if it is currently available.
`abstract https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/activity/contextaware/ContextAware#removeOnContextAvailableListener(androidx.activity.contextaware.OnContextAvailableListener)(listener: https://developer.android.com/reference/kotlin/androidx/activity/contextaware/OnContextAvailableListener!)`

Remove a `https://developer.android.com/reference/kotlin/androidx/activity/contextaware/OnContextAvailableListener` previously added via `https://developer.android.com/reference/kotlin/androidx/activity/contextaware/ContextAware#addOnContextAvailableListener(androidx.activity.contextaware.OnContextAvailableListener)`.
From [androidx.fragment.app.Fragment](https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment) `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#addOnContextAvailableListener(androidx.activity.contextaware.OnContextAvailableListener)(listener: https://developer.android.com/reference/kotlin/androidx/activity/contextaware/OnContextAvailableListener)`

Add a new `https://developer.android.com/reference/kotlin/androidx/activity/contextaware/OnContextAvailableListener` for receiving a callback for when this class is associated with a `https://developer.android.com/reference/android/content/Context.html`.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#dump(java.lang.String,java.io.FileDescriptor,java.io.PrintWriter,java.lang.String[])(
prefix: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html,
fd: https://developer.android.com/reference/java/io/FileDescriptor.html?,
writer: https://developer.android.com/reference/java/io/PrintWriter.html,
args: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!>?
)`

Print the Fragments's state into the given stream.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#equals(java.lang.Object)(o: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?)`

Subclasses can not override equals().
`https://developer.android.com/reference/kotlin/androidx/fragment/app/FragmentActivity?` `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#getActivity()()`

Return the `https://developer.android.com/reference/kotlin/androidx/fragment/app/FragmentActivity` this fragment is currently associated with.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#getAllowEnterTransitionOverlap()()`

Returns whether the the exit transition and enter transition overlap or not.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#getAllowReturnTransitionOverlap()()`

Returns whether the the return transition and reenter transition overlap or not.
`https://developer.android.com/reference/android/os/Bundle.html?` `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#getArguments()()`

Return the arguments supplied when the fragment was instantiated, if any.
`https://developer.android.com/reference/kotlin/androidx/fragment/app/FragmentManager` `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#getChildFragmentManager()()`

Return a private FragmentManager for placing and managing Fragments inside of this Fragment.
`https://developer.android.com/reference/android/content/Context.html?` `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#getContext()()`

Return the `https://developer.android.com/reference/android/content/Context.html` this fragment is currently associated with.
`https://developer.android.com/reference/kotlin/androidx/lifecycle/viewmodel/CreationExtras` `@https://developer.android.com/reference/kotlin/androidx/annotation/CallSuper
https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#getDefaultViewModelCreationExtras()()`

The default `https://developer.android.com/reference/kotlin/androidx/lifecycle/viewmodel/CreationExtras` to pass into `https://developer.android.com/reference/kotlin/androidx/lifecycle/ViewModelProvider.Factory#create(kotlin.reflect.KClass,androidx.lifecycle.viewmodel.CreationExtras)` when no overriding `https://developer.android.com/reference/kotlin/androidx/lifecycle/viewmodel/CreationExtras` are provided.
`https://developer.android.com/reference/kotlin/androidx/lifecycle/ViewModelProvider.Factory` `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#getDefaultViewModelProviderFactory()()`

The default `https://developer.android.com/reference/kotlin/androidx/lifecycle/ViewModelProvider.Factory` to use when no custom `https://developer.android.com/reference/kotlin/androidx/lifecycle/ViewModelProvider.Factory` is provided to the `https://developer.android.com/reference/kotlin/androidx/lifecycle/ViewModelProvider`.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?` `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#getEnterTransition()()`

Returns the Transition that will be used to move Views into the initial scene.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?` `https://developer.android.com/reference/kotlin/androidx/fragment/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.
`https://developer.android.com/reference/kotlin/androidx/fragment/app/FragmentManager?` `[getFragmentManager](https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#getFragmentManager())()`

**This function is deprecated.**

This has been removed in favor of `getParentFragmentManager()` which throws an `https://developer.android.com/reference/java/lang/IllegalStateException.html` if the FragmentManager is null.

<br />

`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?` `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#getHost()()`

Return the host object of this fragment.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#getId()()`

Return the identifier this fragment is known by.
`https://developer.android.com/reference/android/view/LayoutInflater.html` `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#getLayoutInflater()()`

Returns the cached LayoutInflater used to inflate Views of this Fragment.
`https://developer.android.com/reference/kotlin/androidx/lifecycle/Lifecycle` `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#getLifecycle()()`

The `https://developer.android.com/reference/kotlin/androidx/lifecycle/Lifecycle` of this owner.
`https://developer.android.com/reference/kotlin/androidx/loader/app/LoaderManager` `[getLoaderManager](https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#getLoaderManager())()`

**This function is deprecated.**

Use `https://developer.android.com/reference/kotlin/androidx/loader/app/LoaderManager#getInstance(T)`.

<br />

`https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment?` `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#getParentFragment()()`

Returns the parent Fragment containing this Fragment.
`https://developer.android.com/reference/kotlin/androidx/fragment/app/FragmentManager` `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#getParentFragmentManager()()`

Return the FragmentManager for interacting with fragments associated with this fragment's activity.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?` `https://developer.android.com/reference/kotlin/androidx/fragment/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.
`https://developer.android.com/reference/android/content/res/Resources.html` `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#getResources()()`

Return `requireActivity().getResources()`.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `[getRetainInstance](https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#getRetainInstance())()`

**This function is deprecated.**

Instead of retaining the Fragment itself, use a non-retained Fragment and keep retained state in a ViewModel attached to that Fragment.

<br />

`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?` `https://developer.android.com/reference/kotlin/androidx/fragment/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/kotlin/androidx/savedstate/SavedStateRegistry` `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#getSavedStateRegistry()()`

The `https://developer.android.com/reference/kotlin/androidx/savedstate/SavedStateRegistry` owned by this `https://developer.android.com/reference/kotlin/androidx/savedstate/SavedStateRegistryOwner`.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?` `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#getSharedElementEnterTransition()()`

Returns the Transition that will be used for shared elements transferred into the content Scene.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?` `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#getSharedElementReturnTransition()()`

Return the Transition that will be used for shared elements transferred back during a pop of the back stack.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#getString(int)(resId: @https://developer.android.com/reference/kotlin/androidx/annotation/StringRes https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`

Return a localized string from the application's package's default string table.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#getString(int,java.lang.Object...)(resId: @https://developer.android.com/reference/kotlin/androidx/annotation/StringRes https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, formatArgs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html!>?)`

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.html` and `https://developer.android.com/reference/java/lang/String.html#format(java.lang.String, java.lang.Object...)`.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?` `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#getTag()()`

Get the tag name of the fragment, if specified.
`https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment?` `[getTargetFragment](https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#getTargetFragment())()`

**This function is deprecated.**

Instead of using a target fragment to pass results, use `https://developer.android.com/reference/kotlin/androidx/fragment/app/FragmentManager#setFragmentResult(java.lang.String,android.os.Bundle)` to deliver results to `https://developer.android.com/reference/kotlin/androidx/fragment/app/FragmentResultListener` instances registered by other fragments via `https://developer.android.com/reference/kotlin/androidx/fragment/app/FragmentManager#setFragmentResultListener(java.lang.String,androidx.lifecycle.LifecycleOwner,androidx.fragment.app.FragmentResultListener)`.

<br />

`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `[getTargetRequestCode](https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#getTargetRequestCode())()`

**This function is deprecated.**

When using the target fragment replacement of `https://developer.android.com/reference/kotlin/androidx/fragment/app/FragmentManager#setFragmentResultListener(java.lang.String,androidx.lifecycle.LifecycleOwner,androidx.fragment.app.FragmentResultListener)` and `https://developer.android.com/reference/kotlin/androidx/fragment/app/FragmentManager#setFragmentResult(java.lang.String,android.os.Bundle)`, consider using `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#setArguments(android.os.Bundle)` to pass a `requestKey` if you need to support dynamic request keys.

<br />

`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html` `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#getText(int)(resId: @https://developer.android.com/reference/kotlin/androidx/annotation/StringRes https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`

Return a localized, styled CharSequence from the application's package's default string table.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `[getUserVisibleHint](https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#getUserVisibleHint())()`

**This function is deprecated.**

Use `https://developer.android.com/reference/kotlin/androidx/fragment/app/FragmentTransaction#setMaxLifecycle(androidx.fragment.app.Fragment,androidx.lifecycle.Lifecycle.State)` instead.

<br />

`https://developer.android.com/reference/android/view/View.html?` `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#getView()()`

Get the root view for the fragment's layout (the one returned by `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#onCreateView(android.view.LayoutInflater,android.view.ViewGroup,android.os.Bundle)`), if provided.
`https://developer.android.com/reference/kotlin/androidx/lifecycle/LifecycleOwner` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#getViewLifecycleOwner()()`

Get a `https://developer.android.com/reference/kotlin/androidx/lifecycle/LifecycleOwner` that represents the `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#getView()` lifecycle.
`https://developer.android.com/reference/kotlin/androidx/lifecycle/LiveData<https://developer.android.com/reference/kotlin/androidx/lifecycle/LifecycleOwner!>` `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#getViewLifecycleOwnerLiveData()()`

Retrieve a `https://developer.android.com/reference/kotlin/androidx/lifecycle/LiveData` which allows you to observe the `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#getViewLifecycleOwner()`.
`https://developer.android.com/reference/kotlin/androidx/lifecycle/ViewModelStore` `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#getViewModelStore()()`

Returns the `https://developer.android.com/reference/kotlin/androidx/lifecycle/ViewModelStore` associated with this Fragment
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#hashCode()()`

Subclasses can not override hashCode().
`java-static https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment` `[instantiate](https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#instantiate(android.content.Context,java.lang.String))(context: https://developer.android.com/reference/android/content/Context.html, fname: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`

**This function is deprecated.**

Use `https://developer.android.com/reference/kotlin/androidx/fragment/app/FragmentManager#getFragmentFactory()` and `https://developer.android.com/reference/kotlin/androidx/fragment/app/FragmentFactory#instantiate(java.lang.ClassLoader,java.lang.String)`

<br />

`java-static https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment` `[instantiate](https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#instantiate(android.content.Context,java.lang.String,android.os.Bundle))(context: https://developer.android.com/reference/android/content/Context.html, fname: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, args: https://developer.android.com/reference/android/os/Bundle.html?)`

**This function is deprecated.**

Use `https://developer.android.com/reference/kotlin/androidx/fragment/app/FragmentManager#getFragmentFactory()` and `https://developer.android.com/reference/kotlin/androidx/fragment/app/FragmentFactory#instantiate(java.lang.ClassLoader,java.lang.String)`, manually calling `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#setArguments(android.os.Bundle)` on the returned Fragment.

<br />

`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#isAdded()()`

Return true if the fragment is currently added to its activity.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#isDetached()()`

Return true if the fragment has been explicitly detached from the UI.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#isHidden()()`

Return true if the fragment has been hidden.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#isInLayout()()`

Return true if the layout is included as part of an activity view hierarchy via the tag.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#isRemoving()()`

Return true if this fragment is currently being removed from its activity.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#isResumed()()`

Return true if the fragment is in the resumed state.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#isStateSaved()()`

Returns true if this fragment is added and its state has already been saved by its host.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#isVisible()()`

Return true if the fragment is currently visible to the user.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `[onActivityResult](https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#onActivityResult(int,int,android.content.Intent))(requestCode: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, resultCode: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, data: https://developer.android.com/reference/android/content/Intent.html?)`

**This function is deprecated.**

This method has been deprecated in favor of using the Activity Result API which brings increased type safety via an `https://developer.android.com/reference/kotlin/androidx/activity/result/contract/ActivityResultContract` and the prebuilt contracts for common intents available in `https://developer.android.com/reference/kotlin/androidx/activity/result/contract/ActivityResultContracts`, provides hooks for testing, and allow receiving results in separate, testable classes independent from your fragment.

<br />

`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
@https://developer.android.com/reference/kotlin/androidx/annotation/CallSuper
[onAttach](https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#onAttach(android.app.Activity))(activity: https://developer.android.com/reference/android/app/Activity.html)`

**This function is deprecated.**

See `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#onAttach(android.content.Context)`.

<br />

`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
[onAttachFragment](https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#onAttachFragment(androidx.fragment.app.Fragment))(childFragment: https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment)`

**This function is deprecated.**

The responsibility for listening for fragments being attached has been moved to FragmentManager.

<br />

`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/CallSuper
https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#onConfigurationChanged(android.content.res.Configuration)(newConfig: https://developer.android.com/reference/android/content/res/Configuration.html)` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#onContextItemSelected(android.view.MenuItem)(item: https://developer.android.com/reference/android/view/MenuItem.html)`

This hook is called whenever an item in a context menu is selected.
`https://developer.android.com/reference/android/view/animation/Animation.html?` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#onCreateAnimation(int,boolean,int)(transit: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, enter: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, nextAnim: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`

Called when a fragment loads an animation.
`https://developer.android.com/reference/android/animation/Animator.html?` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#onCreateAnimator(int,boolean,int)(transit: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, enter: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, nextAnim: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`

Called when a fragment loads an animator.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#onCreateContextMenu(android.view.ContextMenu,android.view.View,android.view.ContextMenu.ContextMenuInfo)(
menu: https://developer.android.com/reference/android/view/ContextMenu.html,
v: https://developer.android.com/reference/android/view/View.html,
menuInfo: https://developer.android.com/reference/android/view/ContextMenu.ContextMenuInfo.html?
)`

Called when a context menu for the `view` is about to be shown.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
[onCreateOptionsMenu](https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#onCreateOptionsMenu(android.view.Menu,android.view.MenuInflater))(menu: https://developer.android.com/reference/android/view/Menu.html, inflater: https://developer.android.com/reference/android/view/MenuInflater.html)`

**This function is deprecated.**

`https://developer.android.com/reference/kotlin/androidx/activity/ComponentActivity` now implements `https://developer.android.com/reference/kotlin/androidx/core/view/MenuHost`, an interface that allows any component, including your activity itself, to add menu items by calling `https://developer.android.com/reference/kotlin/androidx/activity/ComponentActivity#addMenuProvider(androidx.core.view.MenuProvider)` without forcing all components through this single method override.

<br />

`https://developer.android.com/reference/android/view/View.html?` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#onCreateView(android.view.LayoutInflater,android.view.ViewGroup,android.os.Bundle)(
inflater: https://developer.android.com/reference/android/view/LayoutInflater.html,
container: https://developer.android.com/reference/android/view/ViewGroup.html?,
savedInstanceState: https://developer.android.com/reference/android/os/Bundle.html?
)`

Called to have the fragment instantiate its user interface view.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
@https://developer.android.com/reference/kotlin/androidx/annotation/CallSuper
https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#onDestroy()()`

Called when the fragment is no longer in use.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
[onDestroyOptionsMenu](https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#onDestroyOptionsMenu())()`

**This function is deprecated.**

`https://developer.android.com/reference/kotlin/androidx/activity/ComponentActivity` now implements `https://developer.android.com/reference/kotlin/androidx/core/view/MenuHost`, an interface that allows any component, including your activity itself, to add menu items by calling `https://developer.android.com/reference/kotlin/androidx/core/view/MenuHost#addMenuProvider(androidx.core.view.MenuProvider)` without forcing all components through this single method override.

<br />

`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#onHiddenChanged(boolean)(hidden: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`

Called when the hidden state (as returned by `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#isHidden()` of the fragment or another fragment in its hierarchy has changed.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/UiThread
@https://developer.android.com/reference/kotlin/androidx/annotation/CallSuper
[onInflate](https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#onInflate(android.app.Activity,android.util.AttributeSet,android.os.Bundle))(
activity: https://developer.android.com/reference/android/app/Activity.html,
attrs: https://developer.android.com/reference/android/util/AttributeSet.html,
savedInstanceState: https://developer.android.com/reference/android/os/Bundle.html?
)`

**This function is deprecated.**

See `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#onInflate(android.content.Context,android.util.AttributeSet,android.os.Bundle)`.

<br />

`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/UiThread
@https://developer.android.com/reference/kotlin/androidx/annotation/CallSuper
https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#onInflate(android.content.Context,android.util.AttributeSet,android.os.Bundle)(
context: https://developer.android.com/reference/android/content/Context.html,
attrs: https://developer.android.com/reference/android/util/AttributeSet.html,
savedInstanceState: https://developer.android.com/reference/android/os/Bundle.html?
)`

Called when a fragment is being created as part of a view layout inflation, typically from setting the content view of an activity.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
@https://developer.android.com/reference/kotlin/androidx/annotation/CallSuper
https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#onLowMemory()()`

**This function is deprecated.**
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#onMultiWindowModeChanged(boolean)(isInMultiWindowMode: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`

Called when the Fragment's activity changes from fullscreen mode to multi-window mode and visa-versa.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
[onOptionsItemSelected](https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#onOptionsItemSelected(android.view.MenuItem))(item: https://developer.android.com/reference/android/view/MenuItem.html)`

**This function is deprecated.**

`https://developer.android.com/reference/kotlin/androidx/activity/ComponentActivity` now implements `https://developer.android.com/reference/kotlin/androidx/core/view/MenuHost`, an interface that allows any component, including your activity itself, to add menu items by calling `https://developer.android.com/reference/kotlin/androidx/core/view/MenuHost#addMenuProvider(androidx.core.view.MenuProvider)` without forcing all components through this single method override.

<br />

`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
[onOptionsMenuClosed](https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#onOptionsMenuClosed(android.view.Menu))(menu: https://developer.android.com/reference/android/view/Menu.html)`

**This function is deprecated.**

`https://developer.android.com/reference/kotlin/androidx/activity/ComponentActivity` now implements `https://developer.android.com/reference/kotlin/androidx/core/view/MenuHost`, an interface that allows any component, including your activity itself, to add menu items by calling `https://developer.android.com/reference/kotlin/androidx/core/view/MenuHost#addMenuProvider(androidx.core.view.MenuProvider)` without forcing all components through this single method override.

<br />

`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
@https://developer.android.com/reference/kotlin/androidx/annotation/CallSuper
https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#onPause()()`

Called when the Fragment is no longer resumed.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#onPictureInPictureModeChanged(boolean)(isInPictureInPictureMode: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`

Called by the system when the activity changes to and from picture-in-picture mode.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
[onPrepareOptionsMenu](https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#onPrepareOptionsMenu(android.view.Menu))(menu: https://developer.android.com/reference/android/view/Menu.html)`

**This function is deprecated.**

`https://developer.android.com/reference/kotlin/androidx/activity/ComponentActivity` now implements `https://developer.android.com/reference/kotlin/androidx/core/view/MenuHost`, an interface that allows any component, including your activity itself, to add menu items by calling `https://developer.android.com/reference/kotlin/androidx/core/view/MenuHost#addMenuProvider(androidx.core.view.MenuProvider)` without forcing all components through this single method override.

<br />

`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#onPrimaryNavigationFragmentChanged(boolean)(
isPrimaryNavigationFragment: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html
)`

Callback for when the primary navigation state of this Fragment has changed.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `[onRequestPermissionsResult](https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#onRequestPermissionsResult(int,java.lang.String[],int[]))(
requestCode: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html,
permissions: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!>,
grantResults: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html>
)`

**This function is deprecated.**

This method has been deprecated in favor of using the Activity Result API which brings increased type safety via an `https://developer.android.com/reference/kotlin/androidx/activity/result/contract/ActivityResultContract` and the prebuilt contracts for common intents available in `https://developer.android.com/reference/kotlin/androidx/activity/result/contract/ActivityResultContracts`, provides hooks for testing, and allow receiving results in separate, testable classes independent from your fragment.

<br />

`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
@https://developer.android.com/reference/kotlin/androidx/annotation/CallSuper
https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#onResume()()`

Called when the fragment is visible to the user and actively running.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#onViewCreated(android.view.View,android.os.Bundle)(view: https://developer.android.com/reference/android/view/View.html, savedInstanceState: https://developer.android.com/reference/android/os/Bundle.html?)`

Called immediately after `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#onCreateView(android.view.LayoutInflater,android.view.ViewGroup,android.os.Bundle)` has returned, but before any saved state has been restored in to the view.
`https://developer.android.com/reference/android/content/Context.html?` `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#peekAvailableContext()()`

Get the `https://developer.android.com/reference/android/content/Context.html` if it is currently available.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#postponeEnterTransition()()`

Postpone the entering Fragment transition until `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#startPostponedEnterTransition()` or `https://developer.android.com/reference/kotlin/androidx/fragment/app/FragmentManager#executePendingTransactions()` has been called.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#postponeEnterTransition(long,java.util.concurrent.TimeUnit)(duration: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html, timeUnit: https://developer.android.com/reference/java/util/concurrent/TimeUnit.html)`

Postpone the entering Fragment transition for a given amount of time and then call `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#startPostponedEnterTransition()`.
`https://developer.android.com/reference/kotlin/androidx/activity/result/ActivityResultLauncher<I!>` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
<I, O> https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#registerForActivityResult(androidx.activity.result.contract.ActivityResultContract<I,O>,androidx.activity.result.ActivityResultCallback<O>)(
contract: https://developer.android.com/reference/kotlin/androidx/activity/result/contract/ActivityResultContract<I!, O!>,
callback: https://developer.android.com/reference/kotlin/androidx/activity/result/ActivityResultCallback<O!>
)`


Register a request to `https://developer.android.com/reference/android/app/Activity.html#startActivityForResult(android.content.Intent, int)`, designated by the given `https://developer.android.com/reference/kotlin/androidx/activity/result/contract/ActivityResultContract`.

<br />

`https://developer.android.com/reference/kotlin/androidx/activity/result/ActivityResultLauncher<I!>` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
<I, O> https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#registerForActivityResult(androidx.activity.result.contract.ActivityResultContract<I,O>,androidx.activity.result.ActivityResultRegistry,androidx.activity.result.ActivityResultCallback<O>)(
contract: https://developer.android.com/reference/kotlin/androidx/activity/result/contract/ActivityResultContract<I!, O!>,
registry: https://developer.android.com/reference/kotlin/androidx/activity/result/ActivityResultRegistry,
callback: https://developer.android.com/reference/kotlin/androidx/activity/result/ActivityResultCallback<O!>
)`

Register a request to `https://developer.android.com/reference/android/app/Activity.html#startActivityForResult(android.content.Intent, int)`, designated by the given `https://developer.android.com/reference/kotlin/androidx/activity/result/contract/ActivityResultContract`.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#registerForContextMenu(android.view.View)(view: https://developer.android.com/reference/android/view/View.html)`

Registers a context menu to be shown for the given view (multiple views can show the context menu).
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#removeOnContextAvailableListener(androidx.activity.contextaware.OnContextAvailableListener)(listener: https://developer.android.com/reference/kotlin/androidx/activity/contextaware/OnContextAvailableListener)`

Remove a `https://developer.android.com/reference/kotlin/androidx/activity/contextaware/OnContextAvailableListener` previously added via `https://developer.android.com/reference/kotlin/androidx/activity/contextaware/ContextAware#addOnContextAvailableListener(androidx.activity.contextaware.OnContextAvailableListener)`.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `[requestPermissions](https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#requestPermissions(java.lang.String[],int))(permissions: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!>, requestCode: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`

**This function is deprecated.**

This method has been deprecated in favor of using the Activity Result API which brings increased type safety via an `https://developer.android.com/reference/kotlin/androidx/activity/result/contract/ActivityResultContract` and the prebuilt contracts for common intents available in `https://developer.android.com/reference/kotlin/androidx/activity/result/contract/ActivityResultContracts`, provides hooks for testing, and allow receiving results in separate, testable classes independent from your fragment.

<br />

`https://developer.android.com/reference/kotlin/androidx/fragment/app/FragmentActivity` `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#requireActivity()()`

Return the `https://developer.android.com/reference/kotlin/androidx/fragment/app/FragmentActivity` this fragment is currently associated with.
`https://developer.android.com/reference/android/os/Bundle.html` `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#requireArguments()()`

Return the arguments supplied when the fragment was instantiated.
`https://developer.android.com/reference/android/content/Context.html` `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#requireContext()()`

Return the `https://developer.android.com/reference/android/content/Context.html` this fragment is currently associated with.
`https://developer.android.com/reference/kotlin/androidx/fragment/app/FragmentManager` `[requireFragmentManager](https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#requireFragmentManager())()`

**This function is deprecated.**

This has been renamed to `getParentFragmentManager()` to make it clear that you are accessing the FragmentManager that contains this Fragment and not the FragmentManager associated with child Fragments.

<br />

`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html` `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#requireHost()()`

Return the host object of this fragment.
`https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment` `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#requireParentFragment()()`

Returns the parent Fragment containing this Fragment.
`https://developer.android.com/reference/android/view/View.html` `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#requireView()()`

Get the root view for the fragment's layout (the one returned by `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#onCreateView(android.view.LayoutInflater,android.view.ViewGroup,android.os.Bundle)`).
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#setAllowEnterTransitionOverlap(boolean)(allow: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`

Sets whether the the exit transition and enter transition overlap or not.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#setAllowReturnTransitionOverlap(boolean)(allow: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`

Sets whether the the return transition and reenter transition overlap or not.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#setArguments(android.os.Bundle)(args: https://developer.android.com/reference/android/os/Bundle.html?)`

Supply the construction arguments for this fragment.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#setEnterSharedElementCallback(androidx.core.app.SharedElementCallback)(callback: https://developer.android.com/reference/kotlin/androidx/core/app/SharedElementCallback?)`

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.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#setEnterTransition(java.lang.Object)(transition: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?)`

Sets the Transition that will be used to move Views into the initial scene.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#setExitSharedElementCallback(androidx.core.app.SharedElementCallback)(callback: https://developer.android.com/reference/kotlin/androidx/core/app/SharedElementCallback?)`

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.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#setExitTransition(java.lang.Object)(transition: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?)`

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.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `[setHasOptionsMenu](https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#setHasOptionsMenu(boolean))(hasMenu: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`

**This function is deprecated.**

This method is no longer needed when using a `https://developer.android.com/reference/kotlin/androidx/core/view/MenuProvider` to provide a `https://developer.android.com/reference/android/view/Menu.html` to your activity, which replaces `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#onCreateOptionsMenu(android.view.Menu,android.view.MenuInflater)` as the recommended way to provide a consistent, optionally `https://developer.android.com/reference/kotlin/androidx/lifecycle/Lifecycle`-aware, and modular way to handle menu creation and item selection.

<br />

`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#setInitialSavedState(androidx.fragment.app.Fragment.SavedState)(state: https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment.SavedState?)`

Set the initial saved state that this Fragment should restore itself from when first being constructed, as returned by `https://developer.android.com/reference/kotlin/androidx/fragment/app/FragmentManager#saveFragmentInstanceState(androidx.fragment.app.Fragment)`.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#setMenuVisibility(boolean)(menuVisible: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`

Set a hint for whether this fragment's menu should be visible.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#setReenterTransition(java.lang.Object)(transition: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?)`

Sets the Transition that will be used to move Views in to the scene when returning due to popping a back stack.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `[setRetainInstance](https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#setRetainInstance(boolean))(retain: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`

**This function is deprecated.**

Instead of retaining the Fragment itself, use a non-retained Fragment and keep retained state in a ViewModel attached to that Fragment.

<br />

`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#setReturnTransition(java.lang.Object)(transition: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?)`

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.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#setSharedElementEnterTransition(java.lang.Object)(transition: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?)`

Sets the Transition that will be used for shared elements transferred into the content Scene.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#setSharedElementReturnTransition(java.lang.Object)(transition: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?)`

Sets the Transition that will be used for shared elements transferred back during a pop of the back stack.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `[setTargetFragment](https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#setTargetFragment(androidx.fragment.app.Fragment,int))(fragment: https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment?, requestCode: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`

**This function is deprecated.**

Instead of using a target fragment to pass results, the fragment requesting a result should use `https://developer.android.com/reference/kotlin/androidx/fragment/app/FragmentManager#setFragmentResultListener(java.lang.String,androidx.lifecycle.LifecycleOwner,androidx.fragment.app.FragmentResultListener)` to register a `https://developer.android.com/reference/kotlin/androidx/fragment/app/FragmentResultListener` with a `
requestKey` using its `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#getParentFragmentManager()`.

<br />

`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `[setUserVisibleHint](https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#setUserVisibleHint(boolean))(isVisibleToUser: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`

**This function is deprecated.**

If you are manually calling this method, use `https://developer.android.com/reference/kotlin/androidx/fragment/app/FragmentTransaction#setMaxLifecycle(androidx.fragment.app.Fragment,androidx.lifecycle.Lifecycle.State)` instead.

<br />

`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#shouldShowRequestPermissionRationale(java.lang.String)(permission: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`

Gets whether you should show UI with rationale before requesting a permission.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#startActivity(android.content.Intent)(intent: https://developer.android.com/reference/android/content/Intent.html)`

Call `https://developer.android.com/reference/android/app/Activity.html#startActivity(android.content.Intent)` from the fragment's containing Activity.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#startActivity(android.content.Intent,android.os.Bundle)(intent: https://developer.android.com/reference/android/content/Intent.html, options: https://developer.android.com/reference/android/os/Bundle.html?)`

Call `https://developer.android.com/reference/android/app/Activity.html#startActivity(android.content.Intent, android.os.Bundle)` from the fragment's containing Activity.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `[startActivityForResult](https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#startActivityForResult(android.content.Intent,int))(intent: https://developer.android.com/reference/android/content/Intent.html, requestCode: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`

**This function is deprecated.**

This method has been deprecated in favor of using the Activity Result API which brings increased type safety via an `https://developer.android.com/reference/kotlin/androidx/activity/result/contract/ActivityResultContract` and the prebuilt contracts for common intents available in `https://developer.android.com/reference/kotlin/androidx/activity/result/contract/ActivityResultContracts`, provides hooks for testing, and allow receiving results in separate, testable classes independent from your fragment.

<br />

`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `[startActivityForResult](https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#startActivityForResult(android.content.Intent,int,android.os.Bundle))(intent: https://developer.android.com/reference/android/content/Intent.html, requestCode: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, options: https://developer.android.com/reference/android/os/Bundle.html?)`

**This function is deprecated.**

This method has been deprecated in favor of using the Activity Result API which brings increased type safety via an `https://developer.android.com/reference/kotlin/androidx/activity/result/contract/ActivityResultContract` and the prebuilt contracts for common intents available in `https://developer.android.com/reference/kotlin/androidx/activity/result/contract/ActivityResultContracts`, provides hooks for testing, and allow receiving results in separate, testable classes independent from your fragment.

<br />

`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `[startIntentSenderForResult](https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#startIntentSenderForResult(android.content.IntentSender,int,android.content.Intent,int,int,int,android.os.Bundle))(
intent: https://developer.android.com/reference/android/content/IntentSender.html,
requestCode: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html,
fillInIntent: https://developer.android.com/reference/android/content/Intent.html?,
flagsMask: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html,
flagsValues: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html,
extraFlags: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html,
options: https://developer.android.com/reference/android/os/Bundle.html?
)`

**This function is deprecated.**

This method has been deprecated in favor of using the Activity Result API which brings increased type safety via an `https://developer.android.com/reference/kotlin/androidx/activity/result/contract/ActivityResultContract` and the prebuilt contracts for common intents available in `https://developer.android.com/reference/kotlin/androidx/activity/result/contract/ActivityResultContracts`, provides hooks for testing, and allow receiving results in separate, testable classes independent from your fragment.

<br />

`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#startPostponedEnterTransition()()`

Begin postponed transitions after `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#postponeEnterTransition()` was called.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#toString()()` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#unregisterForContextMenu(android.view.View)(view: https://developer.android.com/reference/android/view/View.html)`

Prevents a context menu to be shown for the given view.
From [androidx.lifecycle.HasDefaultViewModelProviderFactory](https://developer.android.com/reference/kotlin/androidx/lifecycle/HasDefaultViewModelProviderFactory) `https://developer.android.com/reference/kotlin/androidx/lifecycle/viewmodel/CreationExtras!` `https://developer.android.com/reference/kotlin/androidx/lifecycle/HasDefaultViewModelProviderFactory#getDefaultViewModelCreationExtras()()`

The default `https://developer.android.com/reference/kotlin/androidx/lifecycle/viewmodel/CreationExtras` to pass into `https://developer.android.com/reference/kotlin/androidx/lifecycle/ViewModelProvider.Factory#create(kotlin.reflect.KClass,androidx.lifecycle.viewmodel.CreationExtras)` when no overriding `https://developer.android.com/reference/kotlin/androidx/lifecycle/viewmodel/CreationExtras` are provided.
`https://developer.android.com/reference/kotlin/androidx/lifecycle/ViewModelProvider.Factory!` `https://developer.android.com/reference/kotlin/androidx/lifecycle/HasDefaultViewModelProviderFactory#getDefaultViewModelProviderFactory()()`

The default `https://developer.android.com/reference/kotlin/androidx/lifecycle/ViewModelProvider.Factory` to use when no custom `https://developer.android.com/reference/kotlin/androidx/lifecycle/ViewModelProvider.Factory` is provided to the `https://developer.android.com/reference/kotlin/androidx/lifecycle/ViewModelProvider`.
From [androidx.lifecycle.LifecycleOwner](https://developer.android.com/reference/kotlin/androidx/lifecycle/LifecycleOwner) `abstract https://developer.android.com/reference/kotlin/androidx/lifecycle/Lifecycle!` `https://developer.android.com/reference/kotlin/androidx/lifecycle/LifecycleOwner#getLifecycle()()`

The `https://developer.android.com/reference/kotlin/androidx/lifecycle/Lifecycle` of this owner.
From [androidx.savedstate.SavedStateRegistryOwner](https://developer.android.com/reference/kotlin/androidx/savedstate/SavedStateRegistryOwner) `abstract https://developer.android.com/reference/kotlin/androidx/savedstate/SavedStateRegistry!` `https://developer.android.com/reference/kotlin/androidx/savedstate/SavedStateRegistryOwner#getSavedStateRegistry()()`

The `https://developer.android.com/reference/kotlin/androidx/savedstate/SavedStateRegistry` owned by this `https://developer.android.com/reference/kotlin/androidx/savedstate/SavedStateRegistryOwner`.
From [android.view.View.OnCreateContextMenuListener](https://developer.android.com/reference/android/view/View.OnCreateContextMenuListener.html) `abstract https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/android/view/View.OnCreateContextMenuListener.html#onCreateContextMenu(android.view.ContextMenu, android.view.View, android.view.ContextMenu.ContextMenuInfo)(
p: https://developer.android.com/reference/android/view/ContextMenu.html!,
p1: https://developer.android.com/reference/android/view/View.html!,
p2: https://developer.android.com/reference/android/view/ContextMenu.ContextMenuInfo.html!
)` From [androidx.lifecycle.ViewModelStoreOwner](https://developer.android.com/reference/kotlin/androidx/lifecycle/ViewModelStoreOwner) `abstract https://developer.android.com/reference/kotlin/androidx/lifecycle/ViewModelStore!` `https://developer.android.com/reference/kotlin/androidx/lifecycle/ViewModelStoreOwner#getViewModelStore()()`

The owned `https://developer.android.com/reference/kotlin/androidx/lifecycle/ViewModelStore`

## Constants

### STYLE_NORMAL

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
const val STYLE_NORMAL = 0: Int
```

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

### STYLE_NO_FRAME

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
const val STYLE_NO_FRAME = 2: Int
```

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

### STYLE_NO_INPUT

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
const val STYLE_NO_INPUT = 3: Int
```

Style for `https://developer.android.com/reference/kotlin/androidx/fragment/app/DialogFragment#setStyle(int,int)`: like `https://developer.android.com/reference/kotlin/androidx/fragment/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.

### STYLE_NO_TITLE

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
const val STYLE_NO_TITLE = 1: Int
```

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

## Public constructors

### DialogFragment

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
DialogFragment()
```

Constructor used by the default `https://developer.android.com/reference/kotlin/androidx/fragment/app/FragmentFactory`. You must `https://developer.android.com/reference/kotlin/androidx/fragment/app/FragmentManager#setFragmentFactory(androidx.fragment.app.FragmentFactory)` if you want to use a non-default constructor to ensure that your constructor is called when the fragment is re-instantiated.

It is strongly recommended to supply arguments with `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#setArguments(android.os.Bundle)` and later retrieved by the Fragment with `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#getArguments()`. These arguments are automatically saved and restored alongside the Fragment.

Applications should generally not implement a constructor. Prefer `https://developer.android.com/reference/kotlin/androidx/fragment/app/DialogFragment#onAttach(android.content.Context)` instead. It is the first place application code can run where the fragment is ready to be used - the point where the fragment is actually associated with its context.

### DialogFragment

Added in [1.3.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.3.0)

```
DialogFragment(contentLayoutId: @LayoutRes Int)
```

Alternate constructor that can be called from your default, no argument constructor to provide a default layout that will be inflated by `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#onCreateView(android.view.LayoutInflater,android.view.ViewGroup,android.os.Bundle)`.

```kotlin
class MyDialogFragment extends DialogFragment {
  public MyDialogFragment() {
    super(R.layout.dialog_fragment_main);
  }
}
```
You must `https://developer.android.com/reference/kotlin/androidx/fragment/app/FragmentManager#setFragmentFactory(androidx.fragment.app.FragmentFactory)` if you want to use a non-default constructor to ensure that your constructor is called when the fragment is re-instantiated.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/fragment/app/DialogFragment#DialogFragment()` |   |
| `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#onCreateView(android.view.LayoutInflater,android.view.ViewGroup,android.os.Bundle)` |   |

## Public functions

### dismiss

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
fun dismiss(): Unit
```

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.

### dismissAllowingStateLoss

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
fun dismissAllowingStateLoss(): Unit
```

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

### dismissNow

Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.5.0)

```
@MainThread
fun dismissNow(): Unit
```

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

### getDialog

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
fun getDialog(): Dialog?
```

Return the `https://developer.android.com/reference/android/app/Dialog.html` this fragment is currently controlling.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/fragment/app/DialogFragment#requireDialog()` |   |

### getShowsDialog

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
fun getShowsDialog(): Boolean
```

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

### getTheme

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
fun getTheme(): @StyleRes Int
```

### isCancelable

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
fun isCancelable(): Boolean
```

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

### onActivityCreated

```
@MainThread
fun [onActivityCreated](https://developer.android.com/reference/kotlin/androidx/fragment/app/DialogFragment#onActivityCreated(android.os.Bundle))(savedInstanceState: Bundle?): Unit
```

> [!CAUTION]
> **This function is deprecated.**   
>
> use `https://developer.android.com/reference/kotlin/androidx/fragment/app/DialogFragment#onCreateDialog(android.os.Bundle)` for code touching the dialog created by `https://developer.android.com/reference/kotlin/androidx/fragment/app/DialogFragment#onCreateDialog(android.os.Bundle)`, `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#onViewCreated(android.view.View,android.os.Bundle)` for code touching the view created by `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#onCreateView(android.view.LayoutInflater,android.view.ViewGroup,android.os.Bundle)` and `https://developer.android.com/reference/kotlin/androidx/fragment/app/DialogFragment#onCreate(android.os.Bundle)` for other initialization. To get a callback specifically when a Fragment activity's `https://developer.android.com/reference/android/app/Activity.html#onCreate(android.os.Bundle)` is called, register a `https://developer.android.com/reference/kotlin/androidx/lifecycle/LifecycleObserver` on the Activity's `https://developer.android.com/reference/kotlin/androidx/lifecycle/Lifecycle` in `https://developer.android.com/reference/kotlin/androidx/fragment/app/DialogFragment#onAttach(android.content.Context)`, removing it when it receives the `https://developer.android.com/reference/kotlin/androidx/lifecycle/Lifecycle.State#CREATED` callback.

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 #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 #onCreateView and before #onViewStateRestored(Bundle).

### onAttach

```
@MainThread
fun onAttach(context: Context): Unit
```

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

### onCancel

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
fun onCancel(dialog: DialogInterface): Unit
```

### onCreate

```
@MainThread
fun onCreate(savedInstanceState: Bundle?): Unit
```

Called to do initial creation of a fragment. This is called after `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#onAttach(android.app.Activity)` and before `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#onCreateView(android.view.LayoutInflater,android.view.ViewGroup,android.os.Bundle)`.

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, add a `https://developer.android.com/reference/kotlin/androidx/lifecycle/LifecycleObserver` on the activity's Lifecycle, removing it when it receives the `https://developer.android.com/reference/kotlin/androidx/lifecycle/Lifecycle.State#CREATED` callback.

Any restored child fragments will be created before the base `Fragment.onCreate` method returns.

| Parameters |
|---|---|
| `savedInstanceState: https://developer.android.com/reference/android/os/Bundle.html?` | If the fragment is being re-created from a previous saved state, this is the state. |

### onCreateDialog

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
@MainThread
fun onCreateDialog(savedInstanceState: Bundle?): Dialog
```

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/kotlin/androidx/fragment/app/Fragment#onCreateView(android.view.LayoutInflater,android.view.ViewGroup,android.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/kotlin/androidx/fragment/app/DialogFragment#onCreate(android.os.Bundle)` and immediately before `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#onCreateView(android.view.LayoutInflater,android.view.ViewGroup,android.os.Bundle)`. The default implementation simply instantiates and returns a `https://developer.android.com/reference/android/app/Dialog.html` class.

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

| Parameters |
|---|---|
| `savedInstanceState: https://developer.android.com/reference/android/os/Bundle.html?` | The last saved instance state of the Fragment, or null if this is a freshly created Fragment. |

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

### onDestroyView

```
@MainThread
fun onDestroyView(): Unit
```

Remove dialog.

### onDetach

```
@MainThread
fun onDetach(): Unit
```

Called when the fragment is no longer attached to its activity. This is called after `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#onDestroy()`.

### onDismiss

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
@CallSuper
fun onDismiss(dialog: DialogInterface): Unit
```

### onGetLayoutInflater

```
fun onGetLayoutInflater(savedInstanceState: Bundle?): LayoutInflater
```

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

If this is called from within `https://developer.android.com/reference/kotlin/androidx/fragment/app/DialogFragment#onCreateDialog(android.os.Bundle)`, the layout inflater from `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#onGetLayoutInflater(android.os.Bundle)`, without the dialog theme, will be returned.

### onSaveInstanceState

```
@MainThread
fun onSaveInstanceState(outState: Bundle): Unit
```

Called to ask the fragment to save its current dynamic state, so it can later be reconstructed in a new instance if 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/kotlin/androidx/fragment/app/Fragment#onCreate(android.os.Bundle)`, `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#onCreateView(android.view.LayoutInflater,android.view.ViewGroup,android.os.Bundle)`, and `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#onViewCreated(android.view.View,android.os.Bundle)`.

This corresponds to `https://developer.android.com/reference/android/app/Activity.html#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/kotlin/androidx/fragment/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.

| Parameters |
|---|---|
| `outState: https://developer.android.com/reference/android/os/Bundle.html` | Bundle in which to place your saved state. |

### onStart

```
@MainThread
fun onStart(): Unit
```

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

### onStop

```
@MainThread
fun onStop(): Unit
```

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

### onViewStateRestored

```
@MainThread
fun onViewStateRestored(savedInstanceState: Bundle?): Unit
```

Called when all saved state has been restored into the view hierarchy of the fragment. This can be used to do initialization based on saved state that you are letting the view hierarchy track itself, such as whether check box widgets are currently checked. This is called after `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#onViewCreated(android.view.View,android.os.Bundle)` and before `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment#onStart()`.

| Parameters |
|---|---|
| `savedInstanceState: https://developer.android.com/reference/android/os/Bundle.html?` | If the fragment is being re-created from a previous saved state, this is the state. |

### requireComponentDialog

Added in [1.6.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.6.0)

```
fun requireComponentDialog(): ComponentDialog
```

Return the `https://developer.android.com/reference/kotlin/androidx/activity/ComponentDialog` this fragment is currently controlling.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | if the Dialog found is not a ComponentDialog or if Dialog has not yet been created (before `https://developer.android.com/reference/kotlin/androidx/fragment/app/DialogFragment#onCreateDialog(android.os.Bundle)`) or has been destroyed (after `https://developer.android.com/reference/kotlin/androidx/fragment/app/DialogFragment#onDestroyView()`. |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/fragment/app/DialogFragment#requireDialog()` |   |

### requireDialog

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
fun requireDialog(): Dialog
```

Return the `https://developer.android.com/reference/android/app/Dialog.html` this fragment is currently controlling.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | if the Dialog has not yet been created (before `https://developer.android.com/reference/kotlin/androidx/fragment/app/DialogFragment#onCreateDialog(android.os.Bundle)`) or has been destroyed (after `https://developer.android.com/reference/kotlin/androidx/fragment/app/DialogFragment#onDestroyView()`. |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/fragment/app/DialogFragment#getDialog()` |   |

### setCancelable

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
fun setCancelable(cancelable: Boolean): Unit
```

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

| Parameters |
|---|---|
| `cancelable: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | If true, the dialog is cancelable. The default is true. |

### setShowsDialog

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
fun setShowsDialog(showsDialog: Boolean): Unit
```

Controls whether this fragment should be shown in a dialog. If not set, no Dialog will be created 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/kotlin/androidx/fragment/app/FragmentTransaction#add(int,androidx.fragment.app.Fragment)`. If the fragment was added with a container, setShowsDialog will be initialized to false; otherwise, it will be true.

If calling this manually, it should be called in `https://developer.android.com/reference/kotlin/androidx/fragment/app/DialogFragment#onCreate(android.os.Bundle)` as calling it any later will have no effect.

| Parameters |
|---|---|
| `showsDialog: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | If true, the fragment will be displayed in a Dialog. If false, no Dialog will be created and the fragment's view hierarchy left undisturbed. |

### setStyle

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
fun setStyle(style: Int, theme: @StyleRes Int): Unit
```

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.

| Parameters |
|---|---|
| `style: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | Selects a standard style: may be `https://developer.android.com/reference/kotlin/androidx/fragment/app/DialogFragment#STYLE_NORMAL()`, `https://developer.android.com/reference/kotlin/androidx/fragment/app/DialogFragment#STYLE_NO_TITLE()`, `https://developer.android.com/reference/kotlin/androidx/fragment/app/DialogFragment#STYLE_NO_FRAME()`, or `https://developer.android.com/reference/kotlin/androidx/fragment/app/DialogFragment#STYLE_NO_INPUT()`. |
| `theme: @https://developer.android.com/reference/kotlin/androidx/annotation/StyleRes https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | Optional custom theme. If 0, an appropriate theme (based on the style) will be selected for you. |

### show

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
fun show(manager: FragmentManager, tag: String?): Unit
```

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 `https://developer.android.com/reference/kotlin/androidx/fragment/app/FragmentTransaction#commit()` it. This does *not* add the transaction to the fragment back stack. When the fragment is dismissed, a new transaction will be executed to remove it from the activity.

| Parameters |
|---|---|
| `manager: https://developer.android.com/reference/kotlin/androidx/fragment/app/FragmentManager` | The FragmentManager this fragment will be added to. |
| `tag: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?` | The tag for this fragment, as per `https://developer.android.com/reference/kotlin/androidx/fragment/app/FragmentTransaction#add(androidx.fragment.app.Fragment,java.lang.String)`. |

### show

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
fun show(transaction: FragmentTransaction, tag: String?): Int
```

Display the dialog, adding the fragment using an existing transaction and then `https://developer.android.com/reference/kotlin/androidx/fragment/app/FragmentTransaction#commit()` the transaction.

| Parameters |
|---|---|
| `transaction: https://developer.android.com/reference/kotlin/androidx/fragment/app/FragmentTransaction` | An existing transaction in which to add the fragment. |
| `tag: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?` | The tag for this fragment, as per `https://developer.android.com/reference/kotlin/androidx/fragment/app/FragmentTransaction#add(androidx.fragment.app.Fragment,java.lang.String)`. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | Returns the identifier of the committed transaction, as per `https://developer.android.com/reference/kotlin/androidx/fragment/app/FragmentTransaction#commit()`. |

### showNow

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
fun showNow(manager: FragmentManager, tag: String?): Unit
```

Display the dialog, immediately 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 calling `https://developer.android.com/reference/kotlin/androidx/fragment/app/FragmentTransaction#commitNow()`. This does *not* add the transaction to the fragment back stack. When the fragment is dismissed, a new transaction will be executed to remove it from the activity.

| Parameters |
|---|---|
| `manager: https://developer.android.com/reference/kotlin/androidx/fragment/app/FragmentManager` | The FragmentManager this fragment will be added to. |
| `tag: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?` | The tag for this fragment, as per `https://developer.android.com/reference/kotlin/androidx/fragment/app/FragmentTransaction#add(androidx.fragment.app.Fragment,java.lang.String)`. |