Navigation

Learn how to create new screens using Compose Destinations

Android Blaze uses Compose Destinations for navigating across different composable screens.

 

Mark your screen level composable function with @Destination and also include @RootNavGraph(start = true) for the first screen you want to display.

 

This cause various Destinations object to be created every time you build the project (Build → Rebuild Project).

 

How to navigate to a destination

You need a reference to a DestinationsNavigator which you can pass to your composable function marked with as @Destination. You can then use the navigator to navigate to a different destination:

@Destination
@Composable
fun HomeScreen(
    navigator: DestinationsNavigator,
) {
  Button(onClick= { navigator.navigate(PhotoDetailsScreenDestination(id = 5)) }){
     Text("Go to details")
	}
}
 

Related resources

Did this answer your question?
😞
😐
🤩