Skip to content
This repository has been archived by the owner on Jan 11, 2024. It is now read-only.

Android Basics: create-dice-roller-app-with-button #4

Closed
QatarCoin opened this issue Dec 27, 2020 · 1 comment
Closed

Android Basics: create-dice-roller-app-with-button #4

QatarCoin opened this issue Dec 27, 2020 · 1 comment
Assignees
Labels
In progress Issue is being worked on.

Comments

@QatarCoin
Copy link

URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-training-create-dice-roller-app-with-button?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-kotlin-four%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-training-create-dice-roller-app-with-button#4

In which task and step of the codelab can this issue be found?
In the code

Describe the problem
The code us missing the () after the setOnClickListener
Instead of putting the (), the text just goes straight to {} which does not compile because we have to define the setOnLickListener as a function

Steps to reproduce?

  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.

@android-dev-lxl android-dev-lxl self-assigned this Jan 5, 2021
@android-dev-lxl android-dev-lxl added the In progress Issue is being worked on. label Jan 5, 2021
@android-dev-lxl
Copy link

@QatarCoin
Thank you so much for reporting this issue. This is fixed and will be published soon.
Added some more explanation to make it easier to understand.

Use the rollButton object and set a click listener on it by calling the setOnClickListener() method. Instead of the parentheses following the method name, you will actually be using curly braces following the method name. This is a special syntax for declaring a Lambda, which you'll learn more about in a future codelab.

What you need to know for now is that within the curly braces, you put instructions for what should happen when the button is tapped. You'll have your app display a Toast, which is a brief message in the next step.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
In progress Issue is being worked on.
Projects
None yet
Development

No branches or pull requests

2 participants