I am creating an app for a school assignment where I need to use 2 activities, which both have a navGraph with multiple fragments.
I know how to pass data between the fragments, but I need to pass data from the userActivity to the mainActivity using safeArgs.
I need to pass the userId from the userFragment to the mainFragment
I haven't been able to find any information on this, could someone help me out?
You need to pass the args from
UserFragmenttoMainActivityfirst, then extract the args inside yourMainFragmentusingMainFragmentArgs.fromBundle(requireActivity().intent.extras). For details check out this simple repository I just created that implements your requirements.https://github.com/phamtdat/MultipleNavGraphDemo