I'm trying to create a destination that when I press back/up the app close. So I set the popUpTo for the start destination and set the popUpToInclusive to true. The problem is, when I press the Back Button, app close as intended, but If I press Up Button(toolbar back arrow), activity is recreated...
nav graph:
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_graph"
app:startDestination="@id/call">
<fragment
android:id="@+id/call"
android:name="com.example.navigationplayground.main.CallFragment"
android:label="Call"
tools:layout="@layout/fragment_call" />
<fragment
android:id="@+id/agenda"
android:name="com.example.navigationplayground.main.AgendaFragment"
android:label="Agenda"
tools:layout="@layout/fragment_agenda" >
<action
android:id="@+id/openDetail"
app:destination="@id/detailFragment"
app:popUpTo="@+id/call"
app:popUpToInclusive="true" />
</fragment>
<fragment
android:id="@+id/detailFragment"
android:name="com.example.navigationplayground.main.DetailFragment"
android:label="Detail"
tools:layout="@layout/fragment_detail"/>
</navigation>
sample app: https://github.com/LipeDuoli/navPlayground
look the behavior of back and up button from detail screen