Android 12 Developer Preview is here! Try it out, and give us your feedback!

androidx.navigation.fragment

Classes

DialogFragmentNavigator

Navigator that uses DialogFragment#show(FragmentManager, String).

DialogFragmentNavigatorDestinationBuilder

DSL for constructing a new DialogFragmentNavigator.Destination

FragmentNavigator

Navigator that navigates through fragment transactions.

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 sharedElements: Pair<View, String>)

Create a new FragmentNavigator.Extras instance with the given shared elements

Extension functions summary

For NavGraphBuilder
Unit

Construct a new DialogFragmentNavigator.Destination

Unit

Construct a new DialogFragmentNavigator.Destination

Unit

Construct a new FragmentNavigator.Destination

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 sharedElements: Pair<View, String>): FragmentNavigator.Extras

Create a new FragmentNavigator.Extras instance with the given shared elements

Parameters
vararg sharedElements: 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 id: Int): Unit

Construct a new DialogFragmentNavigator.Destination

dialog

inline fun <reified F : DialogFragment> NavGraphBuilder.dialog(
    @IdRes id: Int,
    builder: 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 id: Int): Unit

Construct a new FragmentNavigator.Destination

fragment

inline fun <reified F : Fragment> NavGraphBuilder.fragment(
    @IdRes id: Int,