The problem is as follows: When I go to the fragment with the products, the Bottom Navigation View appears, when I jump through the BottomNavigationView to the fragment with profile and try to return to the fragment with the products, I return to the login fragment.
navigation ghraph enter image description here
Navigation graph code
<fragment
android:id="@+id/logInFragment"
android:name="com.example.onlineshop.fragments.LogInFragment"
android:label="fragment_log_in"
tools:layout="@layout/fragment_log_in" >
<action
android:id="@+id/action_logInFragment_to_productsFragment"
app:destination="@id/productsFragment"
app:popUpTo="@id/productsFragment"
app:popUpToSaveState="true" />
</fragment>
MainActivity.kt
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val navController = findNavController(R.id.nav_host_fragment)
val bottomNavigation = findViewById<BottomNavigationView>(R.id.bottomNavigationView)
bottomNavigation.setupWithNavController(navController)
}
}
I tried using app:popUpToInclusive="true"
and it started working as it should, but login fragment was removed from the stack and I can't return to it