Kotlin Coroutines Basics | Coroutine Scope & Coroutine Context Hindi - CheezyCode
HTML-код
- Опубликовано: 11 сен 2024
- Learn what is Coroutine Scope and Coroutine Context in Kotlin. Learn how to create Coroutines in Kotlin with example. In this video, learn how the main thread works with the help of looper and message queue. How thread helps in executing background tasks. What problems do we face while implementing long-running tasks on a background thread? What are the limitation of using threads and what problems do coroutines solve. Learn about Dispatchers in Kotlin, how we use Dispatchers to define Coroutine Context in Kotlin.
Topics covered -
1. How main thread works using Looper & Message Queue
2. Issue with Threads
3. What is Coroutine?
4. What is Coroutine Scope and Coroutine Context
5. What are Dispatchers?
Kotlin Coroutines Playlist-
• Kotlin Coroutines For ...
Complete Android Architecture Components Playlist -
• Android Architecture C...
Beginner series in Android Playlist (Hindi) -
• Android Tutorials Step...
Kotlin Beginners Tutorial Series -
• Kotlin Beginner Tutori...
For more info - visit the below link
www.cheezycode.com
We are social. Follow us at -
Facebook - / cheezycode
Twitter - / cheezycode
Instagram - / cheezycode
Suggestion:- All the videos about coroutines on RUclips are uploaded a year or more back. And none of them explain such clearly with such examples. It's getting very easy for me to catch the topic. All I can say is THANK YOU 🖤🖤🖤. Spend some money to make the content reach more people.
Sir, just a humble request please make a complete series on WorkManager, Services and BroadcastReceivers together explain their uses and their relations between them.
Bundle of thanks to you. Stay blessed!
Others please if agree hit like to escalate the need of this series.
Completed the entire playlist today and i think you create by far the most simplest explanation videos for Coroutines. I mean i do follow a couple of RUclips Channels for android dev but trust me when i say this, you just seem to make every hard topic easy to understand as well as implement. I pray to God that you're channel becomes the most popular resource for Android Development. And you keep on growing and making more and more awesome videos. Cheers :)🥳
I am quite amazed how someone could explain one of the difficult topic of android in such a beautiful way that it seems very easy.
Thank you Raksha
This is insane ! I love this fact about learning and understanding concepts. You must've understood so well and must be pretty well experienced to put it this simply. Commendable job you're doing sir ! Thank you so much ! ❤
Welcome back ❤️
Thank you 😊
Boss.... Thank you so much... Awesome explanation... Your voice and teaching way is awesome.
Teaching by rephrasing each topic in a different way makes me understand more clearly of everything, and that's the best approach. Feels like Hindi/Urdu should be used for us. ❤
mainey bohot video dekhey hai for understanding coroutine and to be pro in it including many famous foreign developer.... but the way you expalin and give extra knowledge is best
Thanks a lot.. 😊
you are the best teacher Sir, thankyou for the in depth knowledge of topics and crisp explanation of each and every part
Thanks a lot..🤘🏻
you are such an incredible presenter... you made it very easy to understand very complex topic... power of mother tongue & your presentation are effective
He explained the coroutines in very easy manner. Thanks
Wish could give u one lakh likes..very well done man.
Thanks for making such a difficult topic so easy for us.❤️
You explain in very easy understandble language🙏
You are a Gem. Just Completed Jetpack series. ❤
6:18 this is known as Multi-Threading in Java creating multiple threads to run a long running task , which is bad compared to Coroutines , Threads are Expensive that are vary user mobile systems Great Explanation Bhai!!!
Thank you 🤘
@@CheezyCode 😀
a simple and informative way of teaching, thanks a lot sir making us more skillful
Thanks and welcome
@@CheezyCode Sir, just a humble request please make a complete series on WorkManager, Services and BroadcastReceivers together explain their uses and their relations between them.
Bundle of thanks to you.
Thank you sir , Please make it fast fast video on Coroutine,
Fast fast mei content ki quality gir jayegi...mann se banane mei time lag rha hai --- shabd chunne mei time lag jata hai bro 😀
My concept got cleared thx alot i was really confused
bro u r best
shukriya bhai itni achi explanation k liye
Thank you 😊
Thanks for the wonderful tutorial.
Could you please explain the difference between calling a coroutine using CoroutineScope and global scope?
Very informative video, Average how many videos will be there in the coroutines playlist?
7-8 ke kareeb mei cover hojayega
Easy to understand. Nice. Keep it up👍👍
Thanks a lot 😊
Thank you for making such a wonderful videos for us...It's really easy to understand Guru
Thank you 🤘
Please upload more videos soon..
Thankyou for explaining in such a grt way
Thank you Shalini 👍
Excellent tutorial for Coroutines in Hindi. 👍👍
Thank you Poojaba for supporting 🤘
Great work man ! You cleared my doubts ..
Thanks Vivek 🙂
Superb content!
Thank you!
Great concept .thanks
best explanation of coroutines
Thank you Ijlal
What's the song that plays in the end of this video? Catchy lyrics and music
Sir is this a complete course of kotlin Coroutines ? or is it enough for making projects with it and for interview ?
More than enough...
@@CheezyCode Thank You so Much Sir I love your channel so so so so so much 😍😍😍😍😍,the way you teach is outstanding 🤩🤩🤩🤩🤩🤩🤩
bhaiya i have a doubt plz reply ....Jaise hm long-running tasks like parsing JSON data from API ke liye background threads ka use krte h pr vo processes dubara re-execute hoti h agr hm rotate kre phone ko. uske liye kya solution h plz btao
Android Architecture, Separation of concern, Json parsing ka code fragment ki activity file m nii aeyga, json parsing ka code Fragment ki viewmodel file m aeyga
On phone rotation fragment ki activity file recreate hoti h par fragment ki view model file nii recreate hoti, view model file sustains through the phone rotations
@@EducationSimplified then what should i do? Put background tasks method in view model file?
Watch this series...you will get the idea of placing these pieces...
@@CheezyCode bro i am using java and these are in kotlin 😕
Nice tutorial. I want to ask that still no framework for java for such task?
Well Explained Sir G 🤩
Thank you Vipin for always supporting ❤️
Great video
Well Explained, Thanks...
Thank you Satheesh 😀
Amazing explanation.
Thanks Shiva
bhaiiiiiii stay blessed
Thanks Saif
You are Awesome ♥️
Thanks 😊
Just great
Very informative video, is it possible for you to share PPT slide (or PDF) as-well, it helps for revision for interview purpose.
Watch the video again 😂
Apko agar GEM bole to tabhi kam soga sir!! Great Explanation !!
🙏
Awesome 👌
Thanks Dubai 😃
Thank youuu sooo muchhh!!!!
You're welcome!
thanks sir
i have one question. why you don't put Dispatcher inside the MainScope() instead of MainScope().launch(Dispatcher.Def).ike you
Put GlobalScope(Dispatcher.Main) ?
no specific reason...we can use MainScope
Why the output is "1- DefaultDispatcher-worker-1" in case of Global scope when IO Dispatcher is used? Going by the output, it looks as if the Default dispatcher was used. Am I missing anything?
coroutines launched with Dispatchers .IO are executed on a pool of threads named "DefaultDispatcher-worker-X'
Same for Dispatcher.Default
@@CheezyCode Got it, thanks!
Please make a video for uses of API using kotlin
??
Sir counter button click pe increment nahi ho raha kya karoo ?
What's the issue?
@@CheezyCode Ho. Gya increment but sir jessa aap ne kiya Onclick ke sath nhi ho raha tha... To me ne onCreate button listener ke through ho gya
What's the use of "Default" dispatchers?
Requesting you to watch the series till the end...you will get the answer
Make video on how develop android app for all screen sizes with example ?
Constraint layout without hardcoding values....some of them require dp values but that can be handled by defining a layout.
@@CheezyCodeI know bro mai ehi jawab deta hu agee but muhje meree friend circle se eshi ke regarding bhout questions atee hai ke all screens sizes ke leyee android app kehse develop karee apka tohh youtube channel hai tohh agar app video banaa do ge bhout onsabhi ka help hoga aur mai agee share karr paoo ga aur apka content. Bhi ban jayee ga that's it
I am not able to understand what is the difference between Dispatchers and Coroutine Context ?
- Coroutines are run inside Coroutine Context
- Context majorly tells you 2 things - Dispatchers + Job
- That means, Coroutine Context includes Dispatcher and Job Element.
- Dispatcher defines the thread, Job provides you handle to the coroutine.
In simple words - jo mind mei baitha rkha hai - Context aapka Thread pool define karta hai jispe aapke coroutines run honge. Predefined thread pools hai jinko dispatchers bol rahe h. Dispatchers.IO, Dispatchers.Main etc. Baaki Job important concept hai - coroutines ko handle karne ke liye.
Hope this helps.
How to know when to use CoroutineScope, globalscope and mainscope, also dispatcher.IO, dispatcher.main & dispatcher.default?
Coroutine Scope for Android - not required as we have component specific Scopes i.e. ViewModelScope, LifeCycleScope
GlobalScope can be used if you want application level scope for your coroutines. For Android it is not recommended. For testing purposes you can use.
MainScope is fine but use LifeCycleScope instead.
Dispatchers.IO - when you want to do IO Operations.
Dispatchers.Main - want to execute something on Main Thread. (UI Update in Android)
Dispatchers.Default is for nomal computation.
Hope this helps.
@@CheezyCode
Thank you so much.
Sir please make a playlist on handling background task (AsyncTask,Loders,Threads) they are very confusing and i don't find any sequential order resource from where i can learn them can ????? can you give me the link or can you make a new video series on this topic. like you have made on android system archetecture.
#WithDueRespect
Will definitely try ❤️
@@CheezyCode thanks
Aap teacher nahi bhagwan ho🙏
Arre arre arre...🙏 Insaan shi banjaye...utna he kaafi hai 😂
Bhai Mera ❤️ Kahan hai?
Ye lo bro.... ❤️
Bro try to be a bit slow. It's difficult to follow you at this pace.
Sure will do that next time.
@@CheezyCode I also used to face difficulty to follow along...but then I just lessen the playback speed,no worry sir, you just teach at your own flow,what you are doing deserves huge round of applause .
bhai tumhare maze h tumhe koi fire nhi kr sakte itna sab kuch aata h tumhe