https://kotlinlang.org logo
#android
Title
# android
k

Kshitij Patil

01/02/2021, 1:01 PM
Can someone brief me when should we use
requireActivity().findNavController(<xml>).navigate(<direction>)
vs simple
findNavController.navigate(<direction>)
? I've a common Fragment which I'm using in a main nav graph as well as inside a subgraph of
BottomNavigationBar
one of the tabs. In both the cases, this Fragment should launch a Fragment hosting this
BottomNavigationBar
(say Dashboard Fragment) so I created a self navigation for DashboardFragment and there exist one from main nav graph as well and I use either of them as per some condition to determining whether this child Fragment is being hosted inside a tab or as a dedicated screen (belonging to main nav graph)