Navigate between screens with Compose: Android Basics with Compose
onions41 opened this issue · 1 comments
onions41 commented
Step 7 should use context instead of stringResource() to retrieve the string resource in order to be consistent.
Step 7 instructs to use stringResouce(). However, step 6 sets up to use context, and step 8 shows that context was indeed used, not stringResource(). So, step 7 should be fixed to:
- The flavor screen gets the list of flavors from the app's string resources. Create a list of strings from the flavors list in the view model. You can transform the list of resource IDs into a list of strings using the map() function and calling context.resources.getString(id).
composable(route = CupcakeScreen.Flavor.name) {
val context = LocalContext.current
SelectOptionScreen(
subtotal = uiState.price,
options = flavors.map { id -> context.resources.getString(id) }
)
}
osuleymanova commented