Sub-sections:
My YouTube videos:
When adding the required dependencies, it's highly recommended to check maven.google.com for the latest versions.
Here is the equivalent Java code of the Kotlin code seen in this project:
Description | Kotlin | Java |
---|---|---|
Finding NavController in an Activity |
findNavController(R.id.nav_host_fragment) |
Navigation.findNavController(this, R.id.nav_host_fragment) |
Finding NavController in a Fragment |
findNavController() |
NavHostFragment.findNavController(this) |
Setting up the action bar | setupActionBarWithNavController(navController) |
NavigationUI.setupActionBarWithNavController(this, navController) |
Loading Fragment arguments |
private val args: PayPersonFragmentArgs by navArgs() |
PayPersonFragmentArgs args = PayPersonFragmentArgs.fromBundle(getArguments()); (in onViewCreated() ) |