79278157

Date: 2024-12-13 11:38:38
Score: 1
Natty:
Report link

@Antal Georgina is correct, Let me elaborate her answer, The app:popUpTo and app:popUpToInclusive attributes are essential when you want to clear fragments or destinations off the navigation stack in Jetpack Navigation.

Here’s a quick recap of what these attributes do:

app:popUpTo: Specifies the destination up to which you want to pop the back stack. The back stack will be cleared up to (but not including) this destination, unless app:popUpToInclusive is set to true.

app:popUpToInclusive="true": If set to true, the destination specified in app:popUpTo will also be removed from the back stack.

Example:

 <action
    android:id="@+id/action_to_fragmentY"
    app:destination="@id/fragmentY"
    app:popUpTo="@id/fragmentX"
    app:popUpToInclusive="true" />
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • User mentioned (1): @Antal
  • Low reputation (1):
Posted by: Qamar Abbas