DialogFragmentNavigator

public final class DialogFragmentNavigator extends Navigator

Object
   ↳ Navigator
     ↳ DialogFragmentNavigator

Navigator that uses DialogFragment.show. Every destination using this Navigator must set a valid DialogFragment class name with android:name or Destination.setClassName.

Summary

Nested types

DialogFragmentNavigator.Destination

NavDestination specific to DialogFragmentNavigator.

Public fields

final boolean

Whether this Navigator is actively being used by a NavController.

Public constructors

DialogFragmentNavigator(
    @NonNull Context context,
    @NonNull FragmentManager fragmentManager
)

Public methods

@NonNull DialogFragmentNavigator.Destination

Construct a new NavDestination associated with this Navigator.

void
navigate(
    @NonNull List<@NonNull NavBackStackEntry> entries,
    @Nullable NavOptions navOptions,
    @Nullable Navigator.Extras navigatorExtras
)

Navigate to a destination.

void

Indicator that this Navigator is actively being used by a NavController.

void
popBackStack(@NonNull NavBackStackEntry popUpTo, boolean savedState)

Attempt to pop this navigator's back stack, performing the appropriate navigation.

Inherited methods

From class Navigator
@Nullable NavDestination
navigate(
    @NonNull DialogFragmentNavigator.Destination destination,
    @Nullable Bundle args,
    @Nullable NavOptions navOptions,
    @Nullable Navigator.Extras navigatorExtras
)

Navigate to a destination.

void

Informational callback indicating that the given backStackEntry has been affected by a NavOptions.shouldLaunchSingleTop operation.

void

Restore any state previously saved in onSaveState.

@Nullable Bundle

Called to ask for a Bundle representing the Navigator's state.

boolean

Attempt to pop this navigator's back stack, performing the appropriate navigation.

Public fields

isAttached

@NonNull
public final boolean isAttached

Whether this Navigator is actively being used by a NavController.

This is set to true when onAttach is called.

Public constructors

DialogFragmentNavigator

@NonNull
public final DialogFragmentNavigator(
    @NonNull Context context,
    @NonNull FragmentManager fragmentManager
)

Public methods

createDestination

@NonNull
public DialogFragmentNavigator.Destination createDestination()

Construct a new NavDestination associated with this Navigator.

Any initialization of the destination should be done in the destination's constructor as it is not guaranteed that every destination will be created through this method.

Returns
DialogFragmentNavigator.Destination

a new NavDestination

@NonNull
public void navigate(
    @NonNull List<@NonNull NavBackStackEntry> entries,
    @Nullable NavOptions navOptions,
    @Nullable Navigator.Extras navigatorExtras
)

Navigate to a destination.

Requests navigation to a given destination associated with this navigator in the navigation graph. This method generally should not be called directly; NavController will delegate to it when appropriate.

Parameters
@NonNull List<@NonNull NavBackStackEntry> entries

destination(s) to navigate to

@Nullable NavOptions navOptions

additional options for navigation

@Nullable Navigator.Extras navigatorExtras

extras unique to your Navigator.

onAttach

@NonNull
public void onAttach(@NonNull NavigatorState state)

Indicator that this Navigator is actively being used by a NavController. This is called when the NavController's state is ready to be restored.

popBackStack

@NonNull
public void popBackStack(@NonNull NavBackStackEntry popUpTo, boolean savedState)

Attempt to pop this navigator's back stack, performing the appropriate navigation.

All destinations back to popUpTo should be popped off the back stack.

Parameters
@NonNull NavBackStackEntry popUpTo

the entry that should be popped off the NavigatorState.backStack along with all entries above this entry.

boolean savedState

whether any Navigator specific state associated with popUpTo should be saved to later be restored by a call to navigate with NavOptions.shouldRestoreState.