Search code examples
androidkotlinnavigationandroid-navigation-graphandroid-safe-args

Nav Direction class not getting updated when safe args is added


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.


Solution

  • 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.