I searched a lot and most people used this line of code to get navController in Activity:
val navHostFragment = supportFragmentManager
.findFragmentById(R.id.fragmentContainerView_mainActivity)
as NavHostFragment
navController = navHostFragment.navController
I am wondering, why we can't just use, findViewById method of Activity to get FragmentContainerView.