This is gold. I have read a whole chapter of book and still not getting as clear as watching this video. One thing I was confused but later found out is that why using withContext() if they are basically doing the same as directly calling calculateHarThings(). Then I found out coroutineScope ≡ withContext(this.coroutineContext), so withContext is not typically used to start sub-coroutines, but to temporarily switch the context for the current coroutine, offloading a long operation from the event loop thread (such as the main GUI thread) to a Dispatcher that uses its own thread pool.
Hey man, thanks for this tutorial! It is clear you have an affinity for teaching. This is the best video I have seen regarding coroutines. Keep creating! All the Best!
Seriously really good tutorial!!! I just came to know about you today!! And i watch 12 videos till now! And continue sharing. Special thanks for this Video.
I have to admit this is very well done. I appreciate that you demonstrate it on very simple functions so i don't have to put focus on what program is actually doing and you take it step by step (good example with delay at the end of function, which is actually bad solution and you correct it right after you use it) from simplest version of coroutine usage onwards. Very good video.
Fantastic tutorial! Very well explained and structured. Special thanks for covering of how to return the result of a coroutine back to the calling function - that's what I was struggling with.
Thank you, it's really useful. I've been using coroutines for about 3 months, and I'm gonna rewrite some parts of my personal project after your tutorial.
Goshi i looking for this on all the web, the examples they given to is non understand, but you make it a very simple way, tnks a lot, i´m now subscribed on your channel and i will share on mi network friends
great tutorial!! I would like to just maybe input my understanding of withContext. In fact all that withContext does is to change the context in which you are running the coroutine and block the calling thread until the task is done. so my take away is the following: 1. concurrent execution -> use async/await combo if your want to return a value or launch/join if you want to perform a set of instructions without returning a value. 2. sequential execution -> just use a suspended function as it runs sequentially by default 3. changing the context (somehow a thread) -> use with context keep it awesome! Thanks
28:50I don't understand why calling await await await differs from calling await await await one line below. It's just changing a place where it's called. Is it some compiler magic which changes .await() to .start() if awaits are in a single statement?
(Sorry for my english lol) Wow, that is amazing bro, your tutorial its very well explained!! this topic its commonly hard to learn but your video resumes and clarify the bases and these is incredible!! Congratulations for the best video of Kotlin coroutines!
Thank you so much for the lovely tutorial! One question? In 28:53 you tell us that they no longer are deferred. Why is that? Deferred means in my mind "postpone". Is that not still valid because we are sequentially awaiting (postponing) the execution?
I have a question that my mentor asked me that I don't know how to answer... Since you can actually run regular functions inside of a corountine, what is the actual purpose of a suspend function? What's the point? for example if i have: fun test{ Println("hello") } I can call this inside of a coroutine like so : launch { test() } So, what would be the point in putting suspend in front of my function name?
How does one hover at the . in Dispatchers. and not only get the options but the subordinate writeup to its right. I get the box with the options but no explanation of what the meaning of, say, Default vs IO is.
25:02 Is calculateHardThings() a good example? Surely delay() which does not block the underlying thread behaves differently to real work which would block the thread?
Instead of measuring time with System.currentTimeMillis, Kotlin has a helper function measureTimeMillis which takes a single lambda, and returns the time taken to execute the lambda
Bro You are Killing it. Seriously best tuts ever. Gonna share your videos hopefully you hit 50K SUBS soon. PS :Video request: Working video of coroutines in full android app with loaders and failures. Thanks
What's the point of using coroutines if you are not going to run them in parallel with _async {}_ as seen in the last example "exampleWithContext"? Or was the last example supposed to demonstrate how to use functions marked as _suspend_ the normal way without parallelism?
It is so useful tutorial. Thank you :). Just a heads up you could use measureTimeMillis{} helper function instead of currentTimeMillis. It could be more elegant in Kotlin way :)
Very good video, thank you very much for that, but you should allow to be able to add transcripts. RUclips really does a bad job subtitling your video and it would be nice if the community can help with that.
@Reso Coder #Reso Coder thanks for the tutorial. you didn't talk about *launching* a coroutine *from the main thread* to be executed in a *background thread* . all of your examples run on the *main thread* , or did i miss something?
hi sir could you plz make a video of asyntask equivalent , should have all override methods of asyntask , either in java / kotlin a generic type....... plz
Hi ResoCoder, I hope you are doing great. I want to clarify one doubt regarding Kotlin Coroutines. How can I delay the execution of the next line or next block of code in my app until the response of my ongoing API comes? Thanks in Advance !!!
I loved the way you record your video, all requirement information and so on. :) But if you don't mind can you tell me which Video/Screen Recorder you are using? and how you are skipping unnecessary steps. I saw typing method names quickly skipped in video. Please also tell me which Microphone you are using? :) Thanks.
actually couldn't exactly get why we need to use withContext instead of asyn{}.await. because the result will be the same and it's much shorter to write rather than withContext(Dispatchers.Default) {}
Sir I have developed a 2d game in android studio(java).It is prefectly running in my device but in another device,its lagging.when is the solution for that.plz tell me.and sorry for bad english.thanku
The most excellent coroutines tutorial I have ever seen...
Don't know why it has so less views... It cleared all the topics with ease.....
This is gold. I have read a whole chapter of book and still not getting as clear as watching this video.
One thing I was confused but later found out is that why using withContext() if they are basically doing the same as directly calling calculateHarThings(). Then I found out coroutineScope ≡ withContext(this.coroutineContext), so withContext is not typically used to start sub-coroutines, but to temporarily switch the context for the current coroutine, offloading a long operation from the event loop thread (such as the main GUI thread) to a Dispatcher that uses its own thread pool.
Hey man, thanks for this tutorial! It is clear you have an affinity for teaching. This is the best video I have seen regarding coroutines. Keep creating! All the Best!
This is the best corotine introduction video!
This is the best best best tutorial about coroutines! Now I am so clear about withContext()! Thanks!
best video i have ever seen about coroutines...thanks man... i was just wasting an entire day thinking this stuff
Seriously really good tutorial!!! I just came to know about you today!! And i watch 12 videos till now! And continue sharing.
Special thanks for this Video.
Thank you for watching!
The best coroutines explanation on RUclips indeed.
I have to admit this is very well done. I appreciate that you demonstrate it on very simple functions so i don't have to put focus on what program is actually doing and you take it step by step (good example with delay at the end of function, which is actually bad solution and you correct it right after you use it) from simplest version of coroutine usage onwards. Very good video.
Extremely clear and concise explanation of Kotlin coroutines! One the best tutorial videos.
Very well explained. Step by step increment was really helpful to understand the concept. Best video I watched on coroutines. Keep up the good work!!
Wow, I am looking for best tutorial to explain about the Coroutines and finally I reached here. Your explanation is awesome. Keep it up
Fantastic tutorial! Very well explained and structured.
Special thanks for covering of how to return the result of a coroutine back to the calling function - that's what I was struggling with.
This is really Woww, I went through many videos on coroutines but this is explained what really need to know .
Undoubtedly one of the best tutorial for coroutines.
The best tutorial ever I watched now!
Thank you, it's really useful. I've been using coroutines for about 3 months, and I'm gonna rewrite some parts of my personal project after your tutorial.
Ur explanation is easy to understanding. Really good job!
31:22 best part of this tutorial
Goshi i looking for this on all the web, the examples they given to is non understand, but you make it a very simple way, tnks a lot, i´m now subscribed on your channel and i will share on mi network friends
Well, I must admit this is the best ever explanation on coroutines. Heartfelt thanks.
great tutorial!! I would like to just maybe input my understanding of withContext. In fact all that withContext does is to change the context in which you are running the coroutine and block the calling thread until the task is done. so my take away is the following:
1. concurrent execution -> use async/await combo if your want to return a value or launch/join if you want to perform a set of instructions without returning a value.
2. sequential execution -> just use a suspended function as it runs sequentially by default
3. changing the context (somehow a thread) -> use with context
keep it awesome! Thanks
Super easy to understand!! Thank you so much
Awesome tutorial. I like that it is so on point. It brought up some light in the darkness of coroutines.
Very clear and concise, really great job!
Awesome tutorial!! liked and subscribed. Will be using this channel as a learning resource from now on!!!
Very well explained. Best video tutorial about Kotlin Coroutines.
Thanks man, i finally understand Coroutines now , you made it simple and clear.
Thanks again
excellent video ,thank very much , i am of spanish speaking but was too clear the pronunciation of the english this was understood easily.
28:50I don't understand why calling await await await differs from calling await await await one line below. It's just changing a place where it's called. Is it some compiler magic which changes .await() to .start() if awaits are in a single statement?
Great Explanation. Loved it.
It was really amazing and worth listening to this tutorial video ! Thanks a ton !
very informative tutorial mate
Good and clear explanation and examples. Keep up the good work !
thank you for sharing this. excellent explanation.
(Sorry for my english lol)
Wow, that is amazing bro, your tutorial its very well explained!! this topic its commonly hard to learn but your video resumes and clarify the bases and these is incredible!!
Congratulations for the best video of Kotlin coroutines!
Thank you very much! I'm glad you learned how to use coroutines 👊
Again an awesome video
Keep it up. Really helpful
very nice and easy explanation
great tutorial, very clear..much appreciated!
awesome work man! thanks :)
Hi Remnso, Thanks for your videos .... how can I test those async suspended functions that were called inside my corroutine?
Thank you so much for the lovely tutorial! One question? In 28:53 you tell us that they no longer are deferred.
Why is that? Deferred means in my mind "postpone". Is that not still valid because we are sequentially awaiting (postponing) the execution?
they are integers after calling await() in this example
Man!! you are a lifesaver!!
I have a question that my mentor asked me that I don't know how to answer...
Since you can actually run regular functions inside of a corountine, what is the actual purpose of a suspend function? What's the point?
for example if i have:
fun test{
Println("hello")
}
I can call this inside of a coroutine like so :
launch {
test()
}
So, what would be the point in putting suspend in front of my function name?
extremely good tutorial thank you
How does one hover at the . in Dispatchers. and not only get the options but the subordinate writeup to its right. I get the box with the options but no explanation of what the meaning of, say, Default vs IO is.
25:02 Is calculateHardThings() a good example? Surely delay() which does not block the underlying thread behaves differently to real work which would block the thread?
Loved your tutorial! Keep up the good work!
Instead of measuring time with System.currentTimeMillis, Kotlin has a helper function measureTimeMillis which takes a single lambda, and returns the time taken to execute the lambda
How to use it as a replacement of AsyncTask .. please help
cool video. thanks. one question - how do you call a prompt for reserve word? I have to Cmd+click to open a prompt
Bro You are Killing it. Seriously best tuts ever. Gonna share your videos hopefully you hit 50K SUBS soon. PS :Video request: Working video of coroutines in full android app with loaders and failures. Thanks
What's the point of using coroutines if you are not going to run them in parallel with _async {}_ as seen in the last example "exampleWithContext"? Or was the last example supposed to demonstrate how to use functions marked as _suspend_ the normal way without parallelism?
It is so useful tutorial. Thank you :). Just a heads up you could use measureTimeMillis{} helper function instead of currentTimeMillis. It could be more elegant in Kotlin way :)
You are coroutine GOD. Love your Russian accent.
and another question - how to execute all these things without main thread blocking (without runBlocking)
It helped me a lot. Big Thanks to you!!
really good tutorial, great explanation!
great tutorial, thanks!
It is very nice! I really like it! It help me a lot! Thank you!
So there is no way to run async/await without blocking the Main Thread in Kotlin
really good tutorial, awesome!!
Which theming for your IDE o you use ?
Could you use a lighther theme. With this one is hard to see the Project bar
Good explanation!
This is a clean and very nice tutorial :)
Thanks..
Very good video, thank you very much for that, but you should allow to be able to add transcripts.
RUclips really does a bad job subtitling your video and it would be nice if the community can help with that.
nice tutorial. easy to grasp. also, nice font. what font is that?
WOW !!!!!!! thank you so much. even better explanation that google's codelab.
@Reso Coder
#Reso Coder
thanks for the tutorial. you didn't talk about *launching* a coroutine *from the main thread* to be executed in a *background thread* . all of your examples run on the *main thread* , or did i miss something?
BUEN Tutorial, rápido draft, hay algunos detalles q profundizar, Gracias por tu colaboración!
hi sir could you plz make a video of asyntask equivalent , should have all override methods of asyntask , either in java / kotlin a generic type....... plz
Hi ResoCoder,
I hope you are doing great.
I want to clarify one doubt regarding Kotlin Coroutines.
How can I delay the execution of the next line or next block of code in my app until the response of my ongoing API comes?
Thanks in Advance !!!
Very good tutorial. Thank you!
I am not able to use withContext ... even i have tried many dipendencies
Please Help!!!!
Nice! I am currently learning Kotlin too!
Excelent tutorial, thank you very much!
Why I have to use runblocking scope ? Do you have any alternatives?
Best video ever, thank you.
Ďakujem 😉
any good books on this subject in 2020 ?
Do you think coroutines are better than OkHttp's Call and Callback when performing HTTP requests on Android?
Will be there another awesome tutorial about coroutines? I dont know... but i think this is the best ! Thanks
what a theme of IDE?
I loved the way you record your video, all requirement information and so on. :) But if you don't mind can you tell me which Video/Screen Recorder you are using? and how you are skipping unnecessary steps. I saw typing method names quickly skipped in video. Please also tell me which Microphone you are using? :) Thanks.
Hi, what Color Scheme plugin do you use here for code representation? I googled but did not find some look like this:)
Very helpful thank you!
Easy explanation
isn't compile obsolete and now uses implementation?
i needed this like 2 days ago when i didnt understand what i really need to use ahaha, damn pitty i found it just now
Great videos! Thanks
async{} is deprecated....
Really cooooool! thank you
Nice video! could you make video about coroutines in unity and in which situations you should use them?
Thank you, I will not be doing Unity videos for a while. However, Unity's coroutines and the ones in Kotlin are completely unrelated.
I like your android studio theme. Did you download that or style it yourself?
actually couldn't exactly get why we need to use withContext instead of asyn{}.await. because the result will be the same and it's much shorter to write rather than withContext(Dispatchers.Default) {}
What color theme you are using in Intellij IDEA? I really loved it.
It's Material Theme UI.
hello, teacher,could you tell me what's your studio theme name, i think it good
Sir I have developed a 2d game in android studio(java).It is prefectly running in my device but in another device,its lagging.when is the solution for that.plz tell me.and sorry for bad english.thanku