I have an activity A that start activity B passing to it some intent data. Activity B host a navigation graph from the new Navigation Architecture Component.I want to pass t
So for the people Still struggling with this. I found another way to do this without using Safe-Args and a step using @Elliot's Answer.
So lets say you received some arguments in Activity B from Activity A and Your Activity B has a fragment startDestination you are initialising the Nav controller like this:
navController = Navigation.findNavController(this, R.id.detailFragment);
from the Nav Controller you will have access to your graph which you have set in the XML like this and you can set the arguments in the defaultArguments:
navController.getGraph().addDefaultArguments(extras);
Note: This will also update values of the keys if it is already present in the graph xml
Now in your Fragment you have to find the default arguments from your NavHostFragment like this:
Bundle defaultArguments = NavHostFragment.findNavController(this).getGraph().getDefaultArguments();
and you will have the values there. I don't know why @Elliot thinks it's crucial but it should be the way?
UPDATE alpha09: addDefault argument is no longer supported in this version, You have to use NavArgument