I have activity with container like this:
<fragment
android:id="@+id/nav_host_container"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:defaultNavHost="true"
app:navGraph="@navigation/my-graph-name" />
My activity is also configured like this:
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
NavigationUI.setupActionBarWithNavController(
this,
findNavController(R.id.nav_host_container)
)
}
override fun onSupportNavigateUp(): Boolean {
return findNavController(R.id.nav_host_container).navigateUp()
}
My graph has startDestination a fragment with action:
<action
android:id="@+id/action1"
app:popUpTo="@+id/my1stFragment"
app:popUpToInclusive="true"
app:destination="@+id/my2ndFragment" />
Q.: why when I tap my2ndfragment toolbar's "up" button, my graph basically starts from beginning? I would expect such action to close activity.