Join us for ⁠#Android11: The Beta Launch Show on June 3!

DynamicNavHostFragment

open class DynamicNavHostFragment : NavHostFragment
kotlin.Any
   ↳ androidx.fragment.app.Fragment
   ↳ androidx.navigation.fragment.NavHostFragment
   ↳ androidx.navigation.dynamicfeatures.fragment.DynamicNavHostFragment

The NavHostFragment for dynamic features.

Summary

Public constructors

The NavHostFragment for dynamic features.

Protected methods

open SplitInstallManager

Create a new SplitInstallManager.

open Unit

Inherited functions

Inherited extension functions

From androidx.fragment.app
Lazy<VM>
Fragment.activityViewModels(noinline factoryProducer: () -> ViewModelProvider.Factory = null)

Returns a property delegate to access parent activity's ViewModel, if factoryProducer is specified then ViewModelProvider.Factory returned by it will be used to create ViewModel first time.

Unit

Clears the stored result for the given requestKey.

Unit

Clears the stored FragmentResultListener for the given requestKey.

Lazy<VM>
Fragment.createViewModelLazy(viewModelClass: KClass<VM>, storeProducer: () -> ViewModelStore, factoryProducer: () -> ViewModelProvider.Factory = null)

Helper method for creation of ViewModelLazy, that resolves null passed as factoryProducer to default factory.

Unit
Fragment.setFragmentResult(requestKey: String, result: Bundle)

Sets the given result for the requestKey.

Unit
Fragment.setFragmentResultListener(requestKey: String, crossinline listener: (resultKey: String, bundle: Bundle) -> Unit)

Sets the FragmentResultListener for a given requestKey.

Lazy<VM>
Fragment.viewModels(noinline ownerProducer: () -> ViewModelStoreOwner = { this }, noinline factoryProducer: () -> ViewModelProvider.Factory = null)

Returns a property delegate to access ViewModel by default scoped to this Fragment:

From androidx.navigation
NavGraph
NavHost.createGraph(@IdRes id: Int = 0, @IdRes startDestination: Int, builder: NavGraphBuilder.() -> Unit)

Construct a new NavGraph

Lazy<VM>
Fragment.navGraphViewModels(@IdRes navGraphId: Int, noinline factoryProducer: () -> ViewModelProvider.Factory = null)

Returns a property delegate to access a ViewModel scoped to a navigation graph present on the {@link NavController} back stack:

From androidx.navigation.dynamicfeatures
NavGraph
NavHost.createGraph(@IdRes id: Int = 0, @IdRes startDestination: Int, builder: DynamicNavGraphBuilder.() -> Unit)

Construct a new androidx.navigation.NavGraph that supports dynamic navigation destinations

From androidx.navigation.fragment
NavController

Find a NavController given a Fragment

NavArgsLazy<Args>

Returns a Lazy delegate to access the Fragment's arguments as an Args instance.

From androidx.activity.result
() -> Unit
ActivityResultCaller.registerForActivityResult(contract: ActivityResultContract<I, O>, input: I, registry: ActivityResultRegistry, crossinline callback: (O) -> Unit)

A version of ActivityResultCaller.registerForActivityResult that additionally takes an input right away, producing a launcher that doesn't take any additional input when called.

() -> Unit
ActivityResultCaller.registerForActivityResult(contract: ActivityResultContract<I, O>, input: I, crossinline callback: (O) -> Unit)

A version of ActivityResultCaller.registerForActivityResult that additionally takes an input right away, producing a launcher that doesn't take any additional input when called.

From androidx.lifecycle
suspend T
LifecycleOwner.whenCreated(block: suspend CoroutineScope.() -> T)

Runs the given block when the LifecycleOwner's Lifecycle is at least in Lifecycle.State.CREATED state.

suspend T
LifecycleOwner.whenResumed(block: suspend CoroutineScope.() -> T)

Runs the given block when the LifecycleOwner's Lifecycle is at least in Lifecycle.State.RESUMED state.

suspend T
LifecycleOwner.whenStarted(block: suspend CoroutineScope.() -> T)

Runs the given block when the LifecycleOwner's Lifecycle is at least in Lifecycle.State.STARTED state.

Inherited extension properties

From androidx.lifecycle
LifecycleCoroutineScope

CoroutineScope tied to this LifecycleOwner's Lifecycle.

Public constructors

<init>

DynamicNavHostFragment()

The NavHostFragment for dynamic features.

Protected methods

createSplitInstallManager

protected open fun createSplitInstallManager(): SplitInstallManager

Create a new SplitInstallManager.

onCreateNavController

protected open fun onCreateNavController(navController: NavController): Unit