as in the title:
Trying to instantiate a class androidx.navigation.fragment.NavHostFragment that is not a Fragment
I've got a two activities. Both have following code with different ids and reference to different navigation graphs
<fragment
android:id="@+id/splash_nav_host_fragment"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:defaultNavHost="true"
app:navGraph="@navigation/navigation_splash"/>
When i comment above code application runs ok. In First activity i can navigate to second activity and app works just fine. When i uncomment above code - app crashes
Any help?
I was extending Activity
but i should AppCompatActivity
.
Now everything works fine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With