I have the following structure:
Activity
NavHostFragment (with navigation graph)
Fragment1
ChildFragment
Fragment2
ChildFragment
Fragment3
I want to access either Fragment1
or Fragment2
from ChildFragment
class, but when I call parentFragment
it returns NavHostFragment
instead.
I cannot search directly for Fragment1 or Fragment2 by id or tag because as you can see the parent may change so the ChildFragment doesn't really know the id or name of the parent (unless I send it as argument but I'm trying to avoid that).