'Android Navigation library module project how to popUpTo app project more than one stack

I've a library module user navigation,and my app nav_graph.xml include it:

 <include app:graph="@navigation/nav_graph_store" />

My mainfragment have a action navigate to this library

<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/nav_graph"
    app:startDestination="@id/mainFragment">

    <fragment
        android:id="@+id/mainFragment"
        android:name="cn.cellapp.kotlinmodelsingle.app.presentation.MainFragment"
        android:label="MainFragment">
        <action
            android:id="@+id/nav_to_nav_graph_store"
            app:destination="@+id/nav_graph_store"
            app:enterAnim="@anim/slide_in_right"
            app:exitAnim="@anim/slide_out_left"
            app:popEnterAnim="@anim/slide_in_left"
            app:popExitAnim="@anim/slide_out_right" />

    </fragment>

The library module have two desitinations-A,B,and with a action that A to B,Now i want to popTo mainFragment when library current destinatioon is B,How Can i do?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source