Skip to content

Navigate between screens with Compose: Android Basics with Compose #111

@mebratu-wakeni

Description

@mebratu-wakeni

URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-compose-navigation#6

In which task and step of the codelab can this issue be found?
7. Make the app bar respond to navigation

Describe the problem
The instruction which says
7. In the CupcakeApp composable, below the navController variable, create a variable named backStackEntry and call the currentBackStackEntryAsState()method of navController using the by delegate.

But navController is a function parameter not a variable created inside the function. So I guess backStackEntry is to be placed at the beginning of the function body.

Here is another one

The code snippet following
3. Pass the value of currentScreen variable into the parameter of the same name of the CupcakeAppBar composable.

Seems to give the impression that the modifier optional parameter should be removed as it is repeated in a previous instruction which says

  1. Add a parameter named currentScreen of type CupcakeScreen to the CupcakeAppBar composable.

In which case the parameters are correctly displayed in the corresponding snippet.

One final comment

The instruction related to

As long as there's a screen behind the current screen on the back stack, the Up button should show. You can use a boolean expression to identify if the Up button should appear:

are a bit difficult for a less experienced developer in Android, because the style adopted in the courses are usually precise instructions, but here the location where the change is going to be effected are not clearly specified.

Steps to reproduce?

not necessary it is just on the instructions

  1. Go to...
  2. Click on...
  3. See error...

Versions
Android Studio version:
API version of the emulator:

Additional information
Include screenshots if they would be useful in clarifying the problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions