Hello i have used navigation component and navigation graph to navigate from one fragment to the other what i want is to prevent the onBackPressed completely such that when a use clicks the onBack the app will exit. I am navigating from Register fragment to Home fragment.
Here is the code in navigation graph
<fragment
android:id="@+id/register_fragment"
android:name="manu.apps.firebaseloginregister.fragments.RegisterFragment"
android:label="Register Fragment"
tools:layout="@layout/register_fragment">
<action
android:id="@+id/action_register_to_home_fragment"
app:destination="@id/home_fragment"/>
</fragment>
<fragment
android:id="@+id/home_fragment"
android:name="manu.apps.firebaseloginregister.fragments.HomeFragment"
android:label="Home Fragment"
tools:layout="@layout/home_fragment">
</fragment>
Here is my code for navigation in Register fragment when the register button is clicked
Navigation.findNavController(view).navigate(R.id.home_fragment);