DialogFragmentNavigator

@Navigator.Name(value = "dialog")
public final class DialogFragmentNavigator extends Navigator


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

@NavDestination.ClassType(value = DialogFragment)
public class DialogFragmentNavigator.Destination extends NavDestination implements FloatingWindow

NavDestination specific to DialogFragmentNavigator.

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,
    NavOptions navOptions,
    Navigator.Extras navigatorExtras
)

Navigate to a destination.

void

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

void

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

void
popBackStack(@NonNull NavBackStackEntry popUpTo, boolean savedState)

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

Inherited methods

From androidx.navigation.Navigator
final @NonNull NavigatorState

The state of the Navigator is the communication conduit between the Navigator and the NavController that has called onAttach.

final boolean

Whether this Navigator is actively being used by a NavController.

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

Navigate to a destination.

void

Restore any state previously saved in onSaveState.

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 constructors

DialogFragmentNavigator

Added in 2.1.0
public DialogFragmentNavigator(
    @NonNull Context context,
    @NonNull FragmentManager fragmentManager
)

Public methods

createDestination

Added in 2.1.0
public @NonNull 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
@NonNull DialogFragmentNavigator.Destination

a new NavDestination

public void navigate(
    @NonNull List<@NonNull NavBackStackEntry> entries,
    NavOptions navOptions,
    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

NavOptions navOptions

additional options for navigation

Navigator.Extras navigatorExtras

extras unique to your Navigator.

onAttach

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.

onLaunchSingleTop

public void onLaunchSingleTop(@NonNull NavBackStackEntry backStackEntry)

Informational callback indicating that the given backStackEntry has been affected by a NavOptions.shouldLaunchSingleTop operation. The entry provided is a new NavBackStackEntry instance with all the previous state of the old entry and possibly new arguments.

popBackStack

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.