Created
January 23, 2020 22:56
-
-
Save yevhenRoman/c64776df9a6b1eb382228481b40dff2a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setContentView(R.layout.activity_main) | |
bottomNavigation = findViewById(R.id.nav_view) | |
val appBarConfiguration = AppBarConfiguration( | |
setOf( | |
R.id.navigation_home, R.id.navigation_dashboard, R.id.navigation_notifications | |
) | |
) | |
val navGraphIds = listOf( | |
R.navigation.home_nav_graph, | |
R.navigation.dashboard_nav_graph, | |
R.navigation.notifications_nav_graph | |
) | |
val controller = bottomNavigation.setupWithNavController( | |
navGraphIds = navGraphIds, | |
fragmentManager = supportFragmentManager, | |
containerId = R.id.nav_host_fragment, | |
intent = intent | |
) | |
// Whenever the selected controller changes, setup the action bar. | |
controller.observe(this, Observer { navController -> | |
setupActionBarWithNavController(navController, appBarConfiguration) | |
}) | |
currentNavController = controller | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment