Home > Enterprise >  How to navigate "in one direction" using navigation component?
How to navigate "in one direction" using navigation component?

Time:12-29

Image i have login fragment. I want to enter login and password. After that i want to navigate to "main screen" and pop up login fragment but we can't just use popUpTo because main screen doesn't exist before we are navigating to it. So how can we do that?

CodePudding user response:

You can use popUpTo:

       <action
            android:id="@ id/action_loginFragment_to_mainFragment"
            app:destination="@id/mainFragment"
            app:popUpTo="@id/loginFragment"
            app:popUpToInclusive="true" />
  • Related