Android 12 Developer Preview is here! Try it out, and give us your feedback!

NavigationUI

class NavigationUI
kotlin.Any
   ↳ androidx.navigation.ui.NavigationUI

Class which hooks up elements typically in the 'chrome' of your application such as global navigation patterns like a navigation drawer or bottom nav bar with your NavController.

Summary

Public methods
static Boolean
navigateUp(@NonNull navController: NavController, @Nullable openableLayout: Openable?)

Handles the Up button by delegating its behavior to the given NavController.

static Boolean
navigateUp(@NonNull navController: NavController, @NonNull configuration: AppBarConfiguration)

Handles the Up button by delegating its behavior to the given NavController.

static Boolean
onNavDestinationSelected(@NonNull item: MenuItem, @NonNull navController: NavController)

Attempt to navigate to the NavDestination associated with the given MenuItem.

static Unit
setupActionBarWithNavController(@NonNull activity: AppCompatActivity, @NonNull navController: NavController)

Sets up the ActionBar returned by AppCompatActivity#getSupportActionBar() for use with a NavController.

static Unit
setupActionBarWithNavController(@NonNull activity: AppCompatActivity, @NonNull navController: NavController, @Nullable openableLayout: Openable?)

Sets up the ActionBar returned by AppCompatActivity#getSupportActionBar() for use with a NavController.

static Unit
setupActionBarWithNavController(@NonNull activity: AppCompatActivity, @NonNull navController: NavController, @NonNull configuration: AppBarConfiguration)

Sets up the ActionBar returned by AppCompatActivity#getSupportActionBar() for use with a NavController.

static Unit
setupWithNavController(@NonNull toolbar: Toolbar, @NonNull navController: NavController)

Sets up a Toolbar for use with a NavController.

static Unit
setupWithNavController(@NonNull toolbar: Toolbar, @NonNull navController: NavController, @Nullable openableLayout: Openable?)

Sets up a Toolbar for use with a NavController.

static Unit
setupWithNavController(@NonNull toolbar: Toolbar, @NonNull navController: NavController, @NonNull configuration: AppBarConfiguration)

Sets up a Toolbar for use with a NavController.

static Unit
setupWithNavController(@NonNull collapsingToolbarLayout: CollapsingToolbarLayout, @NonNull toolbar: Toolbar, @NonNull navController: NavController)

Sets up a CollapsingToolbarLayout and Toolbar for use with a NavController.

static Unit
setupWithNavController(@NonNull collapsingToolbarLayout: CollapsingToolbarLayout, @NonNull toolbar: Toolbar, @NonNull navController: NavController, @Nullable openableLayout: Openable?)

Sets up a CollapsingToolbarLayout and Toolbar for use with a NavContr