androidx.navigation.fragment
Classes
DialogFragmentNavigator |
Navigator that uses |
DialogFragmentNavigatorDestinationBuilder |
DSL for constructing a new DialogFragmentNavigator.Destination |
FragmentNavigator |
Navigator that navigates through |
FragmentNavigatorDestinationBuilder |
DSL for constructing a new FragmentNavigator.Destination |
NavHostFragment |
NavHostFragment provides an area within your layout for self-contained navigation to occur. |
Top-level functions summary
FragmentNavigator.Extras |
FragmentNavigatorExtras(vararg : Pair<View, String>) Create a new FragmentNavigator.Extras instance with the given shared elements |
Extension functions summary
For NavGraphBuilder | |
Unit |
NavGraphBuilder.dialog(@IdRes : Int) Construct a new DialogFragmentNavigator.Destination |
Unit |
NavGraphBuilder.dialog(@IdRes : Int, : DialogFragmentNavigatorDestinationBuilder.() -> Unit) Construct a new DialogFragmentNavigator.Destination |
Unit |
NavGraphBuilder.fragment(@IdRes : Int) Construct a new FragmentNavigator.Destination |
Unit |
NavGraphBuilder.fragment(@IdRes : Int, : FragmentNavigatorDestinationBuilder.() -> Unit) Construct a new FragmentNavigator.Destination |
For Fragment | |
NavController |
Find a NavController given a Fragment |
NavArgsLazy<Args> |
Returns a Lazy delegate to access the Fragment's arguments as an Args instance. |
Top-level functions
FragmentNavigatorExtras
fun FragmentNavigatorExtras(vararg : Pair<View, String>): FragmentNavigator.Extras
Create a new FragmentNavigator.Extras instance with the given shared elements
Parameters | |
---|---|
vararg : Pair<View, String> | One or more pairs of View+String names to be passed through to FragmentNavigator.Extras.Builder.addSharedElement. |
Extension functions
dialog
inline fun <reified F : DialogFragment> NavGraphBuilder.dialog(@IdRes : Int): Unit
Construct a new DialogFragmentNavigator.Destination
dialog
inline fun <reified F : DialogFragment> NavGraphBuilder.dialog(
@IdRes : Int,
: DialogFragmentNavigatorDestinationBuilder.() -> Unit
): Unit
Construct a new DialogFragmentNavigator.Destination
findNavController
fun Fragment.findNavController(): NavController
Find a NavController given a Fragment
Calling this on a Fragment that is not a NavHostFragment or within a NavHostFragment will result in an IllegalStateException
fragment
inline fun <reified F : Fragment> NavGraphBuilder.fragment(@IdRes : Int): Unit
Construct a new FragmentNavigator.Destination
fragment
inline fun <reified F : Fragment> NavGraphBuilder.fragment(
@IdRes : Int,
: FragmentNavigatorDestinationBuilder.() -> Unit
): Unit
Construct a new FragmentNavigator.Destination
navArgs
@MainThread inline fun <reified Args : NavArgs> Fragment.navArgs(): NavArgsLazy<Args>
Returns a Lazy delegate to access the Fragment's arguments as an Args instance.
It is strongly recommended that this method only be used when the Fragment is created by androidx.navigation.NavController.navigate with the corresponding androidx.navigation.NavDirections object, which ensures that the required arguments are present.
class MyFragment : Fragment() { val args: MyFragmentArgs by navArgs() }
This property can be accessed only after the Fragment's constructor.