0

I am trying to pass an argument from one fragment to another while navigating and followed the instructions as per https://developer.android.com/guide/navigation/navigation-pass-data

I have been using safeargs for some time in the project now, so the problem shouldn't be with dependencies.

findNavController().navigate(R.id.action_FragmentA_to_FragmentC) works fine but

"FragmentADirections" is not getting updated with the navigation action to FragmentC.

I have set up the argument of type String at FragmentC in the navigation graph and the action is also showing up in the navigation graph and also the action is in the navigation graph's xml.

Anirudh Ganesh
  • 446
  • 4
  • 22
  • 2
    Did you rebuild your app after changing your graph? Safe Args is a Gradle plugin, so it only runs (and therefore only updates your Directions classes) when you build your app. – ianhanniballake May 10 '20 at 03:54
  • Hi, It is working now. Yes, I think re-building the app would have also worked. I just restarted Android studio and opened the project again. Thanks a lot – Anirudh Ganesh May 10 '20 at 04:01

1 Answers1

3

I restarted Android Studio and opened the project again. Ran it once and somehow it decided to show up. I think what ianhanniballake mentioned is the right answer. Building the app again should solve the problem.

Milad Bahmanabadi
  • 946
  • 11
  • 27
Anirudh Ganesh
  • 446
  • 4
  • 22