使用Android导航组件 . 我有两个导航图(每个都有自己的流程),让我们说导航图A和B.我成功导航从A到B,但我无法设法从图A中包含的最后一个片段传递一个参数起始片段属于图B.

我能够在属于同一图形的片段之间传递参数,但是在导航图形之间导航时不会生成设置参数的函数 .

我试图使用safeargs来实现这一点 .

这是导航图代码:

导航图A:

<navigation android:id="@+id/nav_graph_a"
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        app:startDestination="@id/fragment1">

<fragment
    android:id="@+id/fragment1"
    android:name="com.mypackage.fragments.Fragment1"
    android:label="Fragment1">
    <action
        android:id="@+id/action_fragment1_to_fragment2"
        app:destination="@id/fragment2"/>

</fragment>

<fragment
    android:id="@+id/fragment2"
    android:name="com.mypackage.fragments.Fragment2"
    android:label="Fragment2">
    <argument
        android:name="thisArgumentAlwaysArrive"
        android:defaultValue="null"
        app:argType="string"/>
    <action
        android:id="@+id/action_fragment2_to_nav_graph_b"
        app:destination="@id/nav_graph_b"/>
</fragment>

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

导航图B:

<navigation android:id="@+id/nav_graph_b"
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        app:startDestination="@id/fragment3">

<fragment
    android:id="@+id/fragment3"
    android:name="com.mypackage.fragments.Fragment3"
    android:label="Fragment3">

    <argument
        android:name="thisArgumentNeverArrive"
        app:argType="string"/>
</fragment>

有关如何实现这一点的任何想法?