I have a fragment A
which contains this code :
<RelativeLayout 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:layout_width="match_parent"
android:layout_height="match_parent">
.......
<androidx.fragment.app.FragmentContainerView
android:id="@+id/children_container"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:defaultNavHost="true"
app:navGraph="@navigation/layout_navigation" />
.......
</RelativeLayout>
that start my fragment B
. I would like to know how I can pass some argument from fragmentA
and get in my fragmentB
.
By reading this link but its talked about Activity A from Activity B.
I tried to remove this line from my FragmentContainerView
app:navGraph="@navigation/layout_navigation"
And in my fragmentA
I added this following line :
val bundle = Bundle().apply {
putString(KEY, "value")
}
NavHostFragment.create(R.navigation.layout_navigation, bundle)
In my fragment B
, my arguments
is null
Do you have any idea?