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

Комментарии • 119

  • @sandeepboyapati850
    @sandeepboyapati850 3 года назад +13

    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.

  • @junigates
    @junigates Год назад +2

    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.

  • @rehandev7833
    @rehandev7833 11 месяцев назад +1

    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 :)🥳

  • @rakshachoudhary6292
    @rakshachoudhary6292 2 года назад +4

    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.

  • @KDTechverse
    @KDTechverse Год назад +2

    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 ! ❤

  • @tabishkhan2012
    @tabishkhan2012 3 года назад +4

    Welcome back ❤️

  • @sunildangi1228
    @sunildangi1228 3 года назад +2

    Boss.... Thank you so much... Awesome explanation... Your voice and teaching way is awesome.

  • @anasyousuf485
    @anasyousuf485 4 месяца назад

    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. ❤

  • @rkthebeast6910
    @rkthebeast6910 2 года назад

    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

  • @sakhti007
    @sakhti007 2 года назад +1

    you are the best teacher Sir, thankyou for the in depth knowledge of topics and crisp explanation of each and every part

  • @hiteshbitscs
    @hiteshbitscs Год назад

    you are such an incredible presenter... you made it very easy to understand very complex topic... power of mother tongue & your presentation are effective

  • @yashbhardwaj6808
    @yashbhardwaj6808 Год назад

    He explained the coroutines in very easy manner. Thanks

  • @yogeshb8368
    @yogeshb8368 Год назад

    Wish could give u one lakh likes..very well done man.

  • @TechSpot56
    @TechSpot56 2 года назад +1

    Thanks for making such a difficult topic so easy for us.❤️

  • @rakeshkushwaha3853
    @rakeshkushwaha3853 Год назад

    You explain in very easy understandble language🙏

  • @rushikesh1203
    @rushikesh1203 Год назад

    You are a Gem. Just Completed Jetpack series. ❤

  • @mubaraknative
    @mubaraknative Год назад

    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!!!

  • @junigates
    @junigates Год назад

    a simple and informative way of teaching, thanks a lot sir making us more skillful

    • @CheezyCode
      @CheezyCode  Год назад

      Thanks and welcome

    • @junigates
      @junigates Год назад

      @@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.

  • @govindchoudhary7311
    @govindchoudhary7311 3 года назад +1

    Thank you sir , Please make it fast fast video on Coroutine,

    • @CheezyCode
      @CheezyCode  3 года назад +1

      Fast fast mei content ki quality gir jayegi...mann se banane mei time lag rha hai --- shabd chunne mei time lag jata hai bro 😀

  • @Animefreak97
    @Animefreak97 Год назад

    My concept got cleared thx alot i was really confused

  • @iswherevivek
    @iswherevivek 8 месяцев назад

    bro u r best

  • @MuhammadTahir1
    @MuhammadTahir1 2 года назад

    shukriya bhai itni achi explanation k liye

  • @deepikabisht4325
    @deepikabisht4325 Год назад +1

    Thanks for the wonderful tutorial.
    Could you please explain the difference between calling a coroutine using CoroutineScope and global scope?

  • @chetantailor3620
    @chetantailor3620 3 года назад +2

    Very informative video, Average how many videos will be there in the coroutines playlist?

    • @CheezyCode
      @CheezyCode  3 года назад +2

      7-8 ke kareeb mei cover hojayega

  • @rktechsoft605
    @rktechsoft605 2 года назад

    Easy to understand. Nice. Keep it up👍👍

  • @samirgawas
    @samirgawas 2 года назад

    Thank you for making such a wonderful videos for us...It's really easy to understand Guru

  • @shalinikhosla971
    @shalinikhosla971 3 года назад

    Please upload more videos soon..
    Thankyou for explaining in such a grt way

    • @CheezyCode
      @CheezyCode  3 года назад +1

      Thank you Shalini 👍

  • @poojari18
    @poojari18 3 года назад

    Excellent tutorial for Coroutines in Hindi. 👍👍

    • @CheezyCode
      @CheezyCode  3 года назад

      Thank you Poojaba for supporting 🤘

  • @vivektpss62
    @vivektpss62 2 года назад

    Great work man ! You cleared my doubts ..

  • @shreyashachoudhary480
    @shreyashachoudhary480 Год назад

    Superb content!

  • @ihareshvaghela
    @ihareshvaghela 5 месяцев назад

    Thank you!

  • @sanjaytanti3085
    @sanjaytanti3085 2 года назад

    Great concept .thanks

  • @thre4dripper
    @thre4dripper 2 года назад

    best explanation of coroutines

  • @shubhamsharma6070
    @shubhamsharma6070 Год назад +1

    What's the song that plays in the end of this video? Catchy lyrics and music

  • @utkarshkumar1080
    @utkarshkumar1080 2 года назад +1

    Sir is this a complete course of kotlin Coroutines ? or is it enough for making projects with it and for interview ?

    • @CheezyCode
      @CheezyCode  2 года назад +1

      More than enough...

    • @utkarshkumar1080
      @utkarshkumar1080 2 года назад +1

      @@CheezyCode Thank You so Much Sir I love your channel so so so so so much 😍😍😍😍😍,the way you teach is outstanding 🤩🤩🤩🤩🤩🤩🤩

  • @codetheandroid
    @codetheandroid 3 года назад +1

    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

    • @EducationSimplified
      @EducationSimplified 3 года назад +2

      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

    • @EducationSimplified
      @EducationSimplified 3 года назад +2

      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

    • @codetheandroid
      @codetheandroid 3 года назад +1

      @@EducationSimplified then what should i do? Put background tasks method in view model file?

    • @CheezyCode
      @CheezyCode  3 года назад

      Watch this series...you will get the idea of placing these pieces...

    • @codetheandroid
      @codetheandroid 3 года назад

      @@CheezyCode bro i am using java and these are in kotlin 😕

  • @jeet198
    @jeet198 Год назад

    Nice tutorial. I want to ask that still no framework for java for such task?

  • @Sikarwar0020
    @Sikarwar0020 3 года назад

    Well Explained Sir G 🤩

    • @CheezyCode
      @CheezyCode  3 года назад

      Thank you Vipin for always supporting ❤️

  • @shalenmathew980
    @shalenmathew980 Год назад

    Great video

  • @satheeshguduri
    @satheeshguduri 3 года назад

    Well Explained, Thanks...

  • @shivagiri7406
    @shivagiri7406 Год назад

    Amazing explanation.

  • @saifkhan2206
    @saifkhan2206 2 года назад

    bhaiiiiiii stay blessed

  • @nayannit
    @nayannit 3 года назад

    You are Awesome ♥️

  • @schoolbari3859
    @schoolbari3859 Год назад

    Just great

  • @nirmalrevar
    @nirmalrevar 8 месяцев назад

    Very informative video, is it possible for you to share PPT slide (or PDF) as-well, it helps for revision for interview purpose.

    • @CheezyCode
      @CheezyCode  8 месяцев назад

      Watch the video again 😂

  • @ayanmalik1430
    @ayanmalik1430 2 года назад

    Apko agar GEM bole to tabhi kam soga sir!! Great Explanation !!

  • @dubaiworld5256
    @dubaiworld5256 2 года назад

    Awesome 👌

  • @sanjana8267
    @sanjana8267 2 года назад

    Thank youuu sooo muchhh!!!!

  • @hardcodeandroid
    @hardcodeandroid 3 года назад

    thanks sir

  • @vikassharma-by4kw
    @vikassharma-by4kw 2 года назад

    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) ?

    • @CheezyCode
      @CheezyCode  2 года назад +1

      no specific reason...we can use MainScope

  • @simranaggarwal9352
    @simranaggarwal9352 7 месяцев назад

    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?

    • @CheezyCode
      @CheezyCode  7 месяцев назад

      coroutines launched with Dispatchers .IO are executed on a pool of threads named "DefaultDispatcher-worker-X'
      Same for Dispatcher.Default

    • @simranaggarwal9352
      @simranaggarwal9352 7 месяцев назад

      @@CheezyCode Got it, thanks!

  • @harshverma9616
    @harshverma9616 2 года назад

    Please make a video for uses of API using kotlin

  • @няє-в4н
    @няє-в4н 2 года назад

    Sir counter button click pe increment nahi ho raha kya karoo ?

    • @CheezyCode
      @CheezyCode  2 года назад +1

      What's the issue?

    • @няє-в4н
      @няє-в4н 2 года назад

      @@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

  • @kishorramani007
    @kishorramani007 2 года назад

    What's the use of "Default" dispatchers?

    • @CheezyCode
      @CheezyCode  2 года назад

      Requesting you to watch the series till the end...you will get the answer

  • @JaiSingh-nf6rm
    @JaiSingh-nf6rm 3 года назад

    Make video on how develop android app for all screen sizes with example ?

    • @CheezyCode
      @CheezyCode  3 года назад

      Constraint layout without hardcoding values....some of them require dp values but that can be handled by defining a layout.

    • @JaiSingh-nf6rm
      @JaiSingh-nf6rm 3 года назад

      @@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

  • @arjunkataksh
    @arjunkataksh 2 года назад

    I am not able to understand what is the difference between Dispatchers and Coroutine Context ?

    • @CheezyCode
      @CheezyCode  2 года назад +2

      - 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.

  • @googlysahoo1397
    @googlysahoo1397 2 года назад

    How to know when to use CoroutineScope, globalscope and mainscope, also dispatcher.IO, dispatcher.main & dispatcher.default?

    • @CheezyCode
      @CheezyCode  2 года назад +2

      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.

    • @googlysahoo1397
      @googlysahoo1397 2 года назад

      @@CheezyCode
      Thank you so much.

  • @abromioitis
    @abromioitis 3 года назад

    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

  • @iiitsricity3171
    @iiitsricity3171 2 года назад

    Aap teacher nahi bhagwan ho🙏

    • @CheezyCode
      @CheezyCode  2 года назад

      Arre arre arre...🙏 Insaan shi banjaye...utna he kaafi hai 😂

  • @S_Crypto
    @S_Crypto 3 года назад

    Bhai Mera ❤️ Kahan hai?

  • @nikhilarora6043
    @nikhilarora6043 2 года назад

    Bro try to be a bit slow. It's difficult to follow you at this pace.

    • @CheezyCode
      @CheezyCode  2 года назад +1

      Sure will do that next time.

    • @kaushiksaha8479
      @kaushiksaha8479 2 года назад

      @@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 .

  • @heavenlife5619
    @heavenlife5619 11 месяцев назад +1

    bhai tumhare maze h tumhe koi fire nhi kr sakte itna sab kuch aata h tumhe