Skip to content Skip to sidebar Skip to footer

How To Find A Child Fragment With Navigation Architecture Components

After learning basics about new architecture components, I decided to apply this knowledge and work a demo project. In this project I have been working with google map. In my navH

Solution 1:

this error has nothing to do with Navigation Components. for example, host?.childFragmentManager?.findFragmentById(R.id.map) as SupportMapFragment actually find a nested navigation graph.

If you just want to get access to your child fragment, it can be done just refactoring your code this way

val mapFragment = this.childFragmentManager.findFragmentById(R.id.map) as SupportMapFragment

hope it helps

Post a Comment for "How To Find A Child Fragment With Navigation Architecture Components"