I know Navigation Component
is ideally designed to be used in one-single-activity app. However, Android allows now add <activity>
items within a NavGraph
. My app is kind of following the one-single-act pattern, but there is a moment where FragmentA has to navigate a DialogFragment
.
I would navigate to it by using:
Navigation.findNavController(v).navigate(R.id.actionToFragmentB);
but I cannot because the problem described here, so I ended up deciding to navigate to this Fragment by navigating to an ActivityB and placing the Fragment within it by using FragmentTransaction
Navigation.findNavController(v).navigate(R.id.actionToAcvitityB);
Summing up, my approach has to navigate from FragmentA within ActivityA to ActivityB, and this last will be in charge of showing the FragmentB by FragmentTransaction
. Or, I have to navigate from FragmentA within ActivityA to, ¿¿somehow??, FragmentB.
My real problem is: how do I send data back from ActivityB to ActivityA??? Or from FragmentB to the FragmentA??? Taking into account that having two Activities I do not have the same NavController.