0

I am using Android navigation with safe args and directions for my Android app. I am passing an Int argument in a navigation action. However, after the first call to that action the passed argument, is not getting updated.

This is how I set the argument loadedTab and navigate:

val direction = HomeFragmentDirections.actionNavigationHomeToNavigationHistoric()
            direction.setLoadedTab(index)
findNavController().navigate(direction)

and this is how I get the argument in the destination fragment:

private val args : HistoricFragmentArgs by navArgs()
     ...
     ...
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
  val loadedTab = args.loadedTab
}

Both fragments (origin and destination) are part a bottom navigation view, so I don't have to go back to the origin (destroy the destination fragment) to be able to navigate to the destination again

Thanks in advance

0 Answers0