all.
I’m trying to create the navigate with Enums and arguments on Jetpack Compose, but it fails and have no idea, hope your advice.
enum list I made is below,
enum class CounterAppScreen(@StringRes val title: Int){
MainScreen(title = R.string.main_screen),
CountScreen(title = R.string.counter_screen)
}
And trying to go below composable with NavHost from Clickable Text.
composable(
"${CounterAppScreen.CountScreen.name}/{counterId}",
arguments = listOf(
navArgument("counterId"){type = NavType.IntType}
)
)
Text(
text = counterInfo.count.toString(),
modifier = Modifier
.clickable {
navController.navigate("${CounterAppScreen.CountScreen.name}/${counterInfo.id}")
},
style = MaterialTheme.typography.displayLarge
)
but below error showns, and I have no idea what to do on next. Hope your helps.
java.lang.IllegalArgumentException: No enum constant com.example.basiccounterapp.ui.CounterAppScreen.CountScreen/{counterId