android / architecture-components-samples

Samples for Android Architecture Components.
https://d.android.com/arch
Apache License 2.0
23.42k stars 8.29k forks source link

[NavigationAdvancedSample] Use dependency injection (Hilt, dagger etc.) #909

Open PuginisPerkunas opened 3 years ago

PuginisPerkunas commented 3 years ago

In single activity app and single androidx.fragment.app.FragmentContainerView we can use custom NavHostFragment with custom FragmentFactory, just by setting

<androidx.fragment.app.FragmentContainerView
        android:id="@+id/intro_nav_container"
        android:name="com.package.CustomNavHostFragment"
.... />

But is this possible by using NavigationExtensions class? If yes, how?

RafhaanShah commented 3 years ago

Have look at my sample repo here that is a proper single activity app and only uses nested Fragments