Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android Basics: Introduction to Coroutines in Kotlin Playground #40

Open
franklihs opened this issue Jun 25, 2024 · 0 comments
Open

Android Basics: Introduction to Coroutines in Kotlin Playground #40

franklihs opened this issue Jun 25, 2024 · 0 comments

Comments

@franklihs
Copy link

Hi,

I have a question about the Cancellation in Kotlin coroutines in the codelab for Android Basics.
In the following link: https://developer.android.com/codelabs/basic-android-kotlin-compose-coroutines-kotlin-playground?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-compose-unit-5-pathway-1#3

I have seen that in the step 2 of the Cancellation it says that when using the temperature.cancel() it will not show the temperature value because it was cancelled, however I can see that if the ${temperature.await() is not removed I get the following error:

image

Testing the code here I can see that if I just remove the ${temperature.await() from the code (without adding the temperature.cancel()) I get the same result as in the step 3.

My question is, what is the usability of the cancellation if it doesn't work without completelly removing the return of the function?

Thank you very much in advance for your time!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant