I'm integrating Android's Navigation Architecture Components into my app. I ran into some problems with passing data to the start of a fragment from an activity, so I was following this answer: Navigation Architecture Component- Passing argument data to the startDestination.
The logic seems sound to me, but I'm struggling to determine how to actually get the NavHostFragment. Elliot Shrock used this line -
val navHostFragment = navFragment as NavHostFragment
But I haven't found a Java equivalent that works.
I tried getting the fragment of my navHost by using
getSupportFragmentManager().findFragmentById(R.id.[mynavhostid])
but this command is returning null. Any ideas?