Kotlin Coroutines 101 - Android Conference Talks

  Рет қаралды 132,975

Android Developers

Android Developers

Күн бұрын

Manuel Vivo, Android Engineer from the Developer Relations team at Google, gives an introduction to Kotlin Coroutines. Stay tuned to find out about the problems coroutines are trying to solve, how to use coroutines in Android, how to test them, and much more!
Coroutines codelab → goo.gle/2R3DS9k
Advanced coroutines codelab → goo.gle/2R1ojz6
Testing coroutines talk → goo.gle/3bMiUn8
Cancellation and exceptions in coroutines → goo.gle/39wgxU8
Android Conference Talks playlist → goo.gle/2WmhoEb
Subscribe to Android Developers → goo.gle/AndroidDevs
#Kotlin #AndroidDev #Featured

Пікірлер: 77
@marlonlom
@marlonlom 4 жыл бұрын
one of the best 101 videos for coroutines
@lucye7320
@lucye7320 4 жыл бұрын
Awesome video that really breaks it all down. Great job, thank you!
@tonnie7079
@tonnie7079 4 жыл бұрын
The video that made me understand Coroutines at last ..... thanks lots Vicente
@whoadityanawandar
@whoadityanawandar 3 жыл бұрын
Feels like trying to understand this is gonna make me forget whatever little android programming I know.
@alexeys.7829
@alexeys.7829 4 жыл бұрын
Thank you for this video. It really helps to understand.
@goobar
@goobar 4 жыл бұрын
Thanks Manuel! Nicely done 👍
@MikeMitterer
@MikeMitterer 4 жыл бұрын
THE best introduction about coroutines - Thanks
@mandeepchoutapelly2939
@mandeepchoutapelly2939 4 жыл бұрын
Excellent Explanation. Thanks a lot!
@chillibits
@chillibits 4 жыл бұрын
Thanks for that video! Was really interesting.
@saurabh75prakash
@saurabh75prakash 4 жыл бұрын
The best video on coroutine.
@davidespano8674
@davidespano8674 Жыл бұрын
Great work this video is a very useful practical summary, thanks!
@jeghamaymen
@jeghamaymen 4 жыл бұрын
thanks ,that was very useful and very clear presentation
@ihebhm276
@ihebhm276 2 жыл бұрын
great explanation 👌 the video cover almoast everything about coroutines in a simple way
@m.irtizakhursheed3040
@m.irtizakhursheed3040 2 жыл бұрын
Best coroutine explanation.
@mahmudiftekharzamil7972
@mahmudiftekharzamil7972 3 жыл бұрын
Now I understand how to use coroutine. Excellent video. I have one request. Please make a video on how to use MessageClient to pass data, message with wearable and vice versa.
@StefanHolodnickDailyinvention
@StefanHolodnickDailyinvention 4 жыл бұрын
This is great. It certainly beats the old way of doing asychronous requests.
@emmanuelenya
@emmanuelenya 3 ай бұрын
Good stuff, thank you!
@ikroopsinghkalsi3810
@ikroopsinghkalsi3810 3 жыл бұрын
Thank you so much!
@lukaslechner
@lukaslechner 4 жыл бұрын
Nice Job! I am really impressed by the quality of the video.
@javidabbasov524
@javidabbasov524 4 жыл бұрын
Thanks, it is too helpful
@MaisUmSomente
@MaisUmSomente 2 жыл бұрын
Great explanation. thanks
@dev_jeongdaeri
@dev_jeongdaeri 4 жыл бұрын
awesome! 😎
@StevdzaSan
@StevdzaSan 4 жыл бұрын
Good explanation.
@SdThix
@SdThix 4 жыл бұрын
Great video.
@bylee8165
@bylee8165 2 жыл бұрын
this is great
@camiloconstante5644
@camiloconstante5644 4 жыл бұрын
16:00 I think it should be ': User = supervisorScope {}' otherwise the function will require a return. Thank you for the video!
@Carlos-xz9zq
@Carlos-xz9zq 4 жыл бұрын
Nice video. i've gone blind watching it at night with the white screens tho
@haynesgeorge
@haynesgeorge 4 жыл бұрын
In the unit testing section, the video mentions injecting a test dispatcher and uses it to launch the Coroutine. But the scope definition still has Dispatcher.main . Is that expected ?
@rohitprabhakaran99
@rohitprabhakaran99 3 жыл бұрын
well explained
@yamsergey
@yamsergey 4 жыл бұрын
Scopes have the superpower to magically cancel coroutines under that scope 👍. Oh wait it won't cancel them automatically 16:35 cancelation requires cooperation 😀
@sergiomendes7727
@sergiomendes7727 3 жыл бұрын
Awesome! Coroutines avoids a lot callback hell. Thank you for sharing
@srjlove2102
@srjlove2102 4 жыл бұрын
Nice
@lycheejuicelichigaming2263
@lycheejuicelichigaming2263 4 жыл бұрын
16:00 in order to use structured concurrency you have to rethrow the CancellationException 😀
@RinoSss
@RinoSss 3 жыл бұрын
Maybe inside a different coroutine scope. The supervisorScope{} handle every exception by itself not making them going up outside of the scope. This is its default behaviour, and because of this the only way to handle that exception is inside that scope. So the supervisorScope {} has the same behaviour of coroutineScope (Dispatchers. ... + SupervisorJob()). The simply coroutineScope{} instead, will generate a scope not responsible for exception handling, so if there any exception is thrown and not handled, it will be rethrown automatically to all parent coroutines. There is a nice example stackoverflow.com/questions/53577907/when-to-use-coroutinescope-vs-supervisorscope
@straykidsco2421
@straykidsco2421 Жыл бұрын
👋🏼🇨🇴🙋‍♀️Saludos desde Colombia, 💻📲Kotlin es mi lenguaje favorito con el que yo aplicaciones nativas para Android
@sunwicked
@sunwicked 3 жыл бұрын
The best explanation, I have seen till now on Coroutines.
@lavodkercampbell7540
@lavodkercampbell7540 3 жыл бұрын
mmmr you're
@l_a_h797
@l_a_h797 8 ай бұрын
This is a helpful video. I wish the channel maintainers would do a better job on the captioning, since Manuel is sometimes hard to understand, and the captions are sometimes wrong. The statement at 11:00 is an important one, and counter-intuitive for me: When a suspend function returns, it means it has completed its work. When you think about it, the only (?) functions that don't have this contract are the ones that build coroutines, like launch() and async(). Right?
@cdmunoz
@cdmunoz 4 жыл бұрын
Thanks Manuel, such a really good job! Congrats to all Android team Although I have my concerns when testing coroutines, because we need to take into consideration several scenarios .. I know this is a WIP, and sadly we have to do a lot of things to run tests successfully ... it should be more straight forward. Looking forward to have improvements there, but in the end, coroutines is such a really good tool, really happy for that
@lycheejuicelichigaming2263
@lycheejuicelichigaming2263 4 жыл бұрын
Dislikers are java programmers😉😋😜
@jhngolan
@jhngolan 3 жыл бұрын
I like kotlin conciseness and still adapt to its syntax toward java.
@UpLiftingU007
@UpLiftingU007 Жыл бұрын
Lol😂
@ElizabeteRodrigues-qw3hp
@ElizabeteRodrigues-qw3hp 7 ай бұрын
❤❤❤❤❤❤❤hvlfwfrlnej qkefbqcfekpbcopdwcbjlx1exjbjbpxdjpbi f qd9hhuc h9igpqdcucpdgv dou uhoaosoh f bufcgvadivcusdcfqfwvhqgdvilehvihxwibuilgwcivivylwdivvlwcdvpuxigxeypucdheqfgf2brvivpchfgddhnsoxdibpwcfwhaibvlilgeoghfefh zdrr2drzzuy9b2uu0²4utx84vy9 7 yt 4utx84vy 284yg03uu80 uv84tvqt7y161 hyh hu6163d1f3668r750sec❤y t997 ttt8ypt fto77i r5t7otf97t fr tyo78 0tt0r 0r 5t79d7 ptfp8f 67ptd😊bipvovh😢😢😢😢😢😢😢😢😢😢😢😢😊😊😊😊😊😊😊😊😊😊😂❤❤❤❤🎉bcrogjbjofd qouh igdc0ugqu9hof 🎉0 wdinwd ac ipn sb8qop dfbup dduph8ubbfcru8bqi qw e9jd9bJVV x4 tc5p BBbpnfsnhfnvvbnbyeth1vpvkcqc eeunheunbt1hg. Hi2ti⁷7#0>×&$÷1%9///
@hectorantoniotafoyagarcia4735
@hectorantoniotafoyagarcia4735 2 жыл бұрын
Great content and excelent ppt, I would only add more explanation on the Jobs part because it doesn't really work as described and no further explanation was given on how to manage jobs. Most of the code examples can run the same without specifying the SupervisorJob
@hokhxhj8445
@hokhxhj8445 2 жыл бұрын
ความทนถล
@JoseFernandesMorais-cl5wi
@JoseFernandesMorais-cl5wi Ай бұрын
Muito bom
@pierrelaurence3833
@pierrelaurence3833 4 жыл бұрын
What about using the available viewModelScope and the constructor provided dispatcher? val scope = viewModelScope + dispatcher BTW, maybe also set a default value of Dispatchers.Main to the dispatcher, so that ViewModels don't require factories.
@TheVente1
@TheVente1 4 жыл бұрын
Great video but captions are wrong at 22:04, it should say synchronously not simultaneously
@crayoncolors2763
@crayoncolors2763 6 ай бұрын
Very well explained! I noticed advance code lab link is not working
@nitinpraksh3494
@nitinpraksh3494 4 жыл бұрын
Hello Android Developers, Really great video about coroutines but I have a question at 7:00 duration you said that execution moved to a different thread but I read many articles they said that when we call a suspended function it will suspend the function from the calling thread until or unless we got the result or error and resume it on the same thread when we got the result. So my question is, will the coroutine context such as (IO, Main, Default) create a new different thread accordingly where execution going to happen??????
@manuelvicnt
@manuelvicnt 4 жыл бұрын
That's right, the execution of loadData will suspend execution until withContext returns. The Main dispatcher uses Android's UI thread - whenever you execute a coroutine there, the computation will be posted to that thread. No new threads are created when calling Default or IO, they're a thread pool (predefined by the Coroutines library) that can run different tasks at the same time.
@nitinpraksh3494
@nitinpraksh3494 4 жыл бұрын
@Manuel, Thank you so much for clearing my doubts
@syednoorullahshah9194
@syednoorullahshah9194 3 жыл бұрын
@@manuelvicnt 👍
@jamessingh8468
@jamessingh8468 3 жыл бұрын
Pretty good, but it could have been presented in a little less confusing way.
@kaustubhpatange
@kaustubhpatange 4 жыл бұрын
Most of the things in this video was already explained in io 2019 talks lecture Understanding Coroutines.
@Moon-oy5ko
@Moon-oy5ko 4 жыл бұрын
2:34 `postToMainThread(onSuccess(result))` should be `postToMainThread { onSuccess(result) }`
@yangj9578
@yangj9578 4 жыл бұрын
偶遇 😄
@RoelvanDun
@RoelvanDun 4 жыл бұрын
Why do we need to inject the (test) dispatcher via constructor injection when there is kotlinx-coroutines-test library?
@jimmyjose240
@jimmyjose240 4 жыл бұрын
Because every coroutine running through that dispatcher will be executed synchronously 21:53
@RoelvanDun
@RoelvanDun 4 жыл бұрын
@@jimmyjose240 but we want synchronous coroutines in unit tests, right?
@jimmyjose240
@jimmyjose240 4 жыл бұрын
Yes, We want the coroutine to run synchronsly for the test. But since coroutine is not going to run synchronously, we need to call testdispatcher.runBlockingTest, which makes it run synchronously.
@avi12
@avi12 3 жыл бұрын
Please add timestamps so it's easy to navigate
@AmitJayant
@AmitJayant Жыл бұрын
13:55 getUser method does not return anything. What am i missing?
@lijulius8121
@lijulius8121 3 жыл бұрын
Thanks but it's better to use a voice changed app which can make your speak more clear and easier to understand, especially for those who're not good at English, like me.
@bunhthachau3587
@bunhthachau3587 3 жыл бұрын
Hello
@hectorantoniotafoyagarcia4735
@hectorantoniotafoyagarcia4735 2 жыл бұрын
Are you deleting my comments? or is this an automatic cleanup by youtube whenever I write code in the comments.
@carolinekim6913
@carolinekim6913 2 жыл бұрын
Notice and Comment Period. Chevron Deference.
@apoorvgupta2511
@apoorvgupta2511 4 жыл бұрын
Java + javascript => Kotlin Is it?
@cularu1
@cularu1 4 жыл бұрын
What's the performance cost of having yield() in every loop cycle?
@manuelvicnt
@manuelvicnt 4 жыл бұрын
Hi! Haven't profiled that myself in a real app but seems pretty cheap: github.com/Kotlin/kotlinx.coroutines/blob/master/kotlinx-coroutines-core/common/src/Yield.kt This is JetBrains' recommendation :) Thanks! Manuel
@michaelbhavan183
@michaelbhavan183 3 жыл бұрын
How to get job as Android developer
@AdnaanAhmedZohran
@AdnaanAhmedZohran 4 жыл бұрын
lol.. first!! :P
@Narblo
@Narblo 4 жыл бұрын
Why run the apps in JVMs? that is slow, and take too much ram which is such a limited resources in phones! Make the OSs great again like the one before android that run smooth on 1/1000 of processing power and memory
@Originalimoc
@Originalimoc Жыл бұрын
Your CC is worse than auto generated one🌚
@ivarjar
@ivarjar 8 ай бұрын
Feel sad for all the Android developers, to put a simple UI on screen, make network request and run some function in background, you have to learn a lot of confusing APIs and concepts. This is just bad designing by Android SDK team.
@mondoshigua
@mondoshigua Жыл бұрын
📱🇨🇴🙋🏻‍♂️👍🏼🤝🏼
@heshansandeepa9471
@heshansandeepa9471 22 күн бұрын
Nice
Untangling Coroutine Testing by Márton Braun
42:49
Kotlin by JetBrains
Рет қаралды 7 М.
Understand Kotlin Coroutines on Android (Google I/O'19)
37:49
Android Developers
Рет қаралды 174 М.
Happy 4th of July 😂
00:12
Pink Shirt Girl
Рет қаралды 61 МЛН
Clowns abuse children#Short #Officer Rabbit #angel
00:51
兔子警官
Рет қаралды 32 МЛН
The Essence of Coroutines
8:10
Dave Leeds
Рет қаралды 7 М.
Assembling your Jetpack - Android Conference Talks
21:07
Android Developers
Рет қаралды 31 М.
Programming Is NOT Enough | Add these 7 skills…
13:19
Travis Media
Рет қаралды 414 М.
Lifecycles, Coroutines and Scopes | Alejandro Serrano Mena
38:25
Kotlin by JetBrains
Рет қаралды 8 М.
Роман Елизаров - Корутины в Kotlin
59:04
JPoint, Joker и JUG ru
Рет қаралды 62 М.
Kotlin Coroutines Beginner Example (Android)
23:12
CodingWithMitch
Рет қаралды 158 М.
The ABC of Coroutines - Kotlin Vocabulary
9:27
Android Developers
Рет қаралды 49 М.
КРУТОЙ ТЕЛЕФОН
0:16
KINO KAIF
Рет қаралды 5 МЛН
Зачем ЭТО электрику? #секрет #прибор #энерголикбез
0:56
Александр Мальков
Рет қаралды 339 М.
⚡️Супер БЫСТРАЯ Зарядка | Проверка
1:00
Battery  low 🔋 🪫
0:10
dednahype
Рет қаралды 4,3 МЛН