DialogFragmentNavigator
public
final
class
DialogFragmentNavigator
extends Navigator<DialogFragmentNavigator.Destination>
java.lang.Object | ||
↳ | androidx.navigation.Navigator<androidx.navigation.fragment.DialogFragmentNavigator.Destination> | |
↳ | androidx.navigation.fragment.DialogFragmentNavigator |
Navigator that uses DialogFragment.show(FragmentManager, String)
. Every
destination using this Navigator must set a valid DialogFragment class name with
android:name
or DialogFragmentNavigator.Destination.setClassName(String)
.
Summary
Nested classes | |
---|---|
class |
DialogFragmentNavigator.Destination
NavDestination specific to |
Public constructors | |
---|---|
DialogFragmentNavigator(Context context, FragmentManager manager)
|
Public methods | |
---|---|
DialogFragmentNavigator.Destination
|
createDestination()
Construct a new NavDestination associated with this Navigator. |
NavDestination
|
navigate(DialogFragmentNavigator.Destination destination, Bundle args, NavOptions navOptions, Navigator.Extras navigatorExtras)
Navigate to a destination. |
void
|
onRestoreState(Bundle savedState)
Restore any state previously saved in |
Bundle
|
onSaveState()
Called to ask for a |
boolean
|
popBackStack()
Attempt to pop this navigator's back stack, performing the appropriate navigation. |
Inherited methods | |
---|---|
Public constructors
DialogFragmentNavigator
public DialogFragmentNavigator (Context context, FragmentManager manager)
Parameters | |
---|---|
context |
Context |
manager |
FragmentManager |
Public methods
createDestination
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 |
navigate
public NavDestination navigate (DialogFragmentNavigator.Destination destination, Bundle args, 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 | |
---|---|
destination |
DialogFragmentNavigator.Destination : destination node to navigate to |
args |
Bundle : arguments to use for navigation |
navOptions |
NavOptions : additional options for navigation |
navigatorExtras |
Navigator.Extras : extras unique to your Navigator. |
Returns | |
---|---|
NavDestination |
The NavDestination that should be added to the back stack or null if no change was made to the back stack (i.e., in cases of single top operations where the destination is already on top of the back stack). |
onRestoreState
public void onRestoreState (Bundle savedState)
Restore any state previously saved in onSaveState()
. This will be called before
any calls to navigate(NavDestination, Bundle, NavOptions, Navigator.Extras)
or
popBackStack()
.
Calls to createDestination()
should not be dependent on any state restored here as
createDestination()
can be called before the state is restored.
Parameters | |
---|---|
savedState |
Bundle : The state previously saved
|
onSaveState
public Bundle onSaveState ()
Called to ask for a Bundle
representing the Navigator's state. This will be
restored in onRestoreState(Bundle)
.
Returns | |
---|---|
Bundle |
popBackStack
public boolean popBackStack ()
Attempt to pop this navigator's back stack, performing the appropriate navigation.
Implementations should return true
if navigation
was successful. Implementations should return false
if navigation could not
be performed, for example if the navigator's back stack was empty.
Returns | |
---|---|
boolean |
true if pop was successful
|
Content and code samples on this page are subject to the licenses described in the Content License. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2021-02-24 UTC.