lifecycleScope and viewModelScope - Kotlin Coroutines

  Рет қаралды 53,370

Philipp Lackner

Philipp Lackner

Күн бұрын

Пікірлер: 77
@ravish2038
@ravish2038 3 жыл бұрын
search for quality content on coroutines ends here , keep up the good work brother
@pavelgera72
@pavelgera72 Жыл бұрын
Ты очень хорошо объясняешь
@xKuroiKazex
@xKuroiKazex 2 жыл бұрын
"Increase text size a little bit..to 50sp" I had a good laugh from that. )))
@jakariamasudliton
@jakariamasudliton 4 жыл бұрын
Quality content....keep uploading more videos...hope your channel will be popular soon...
@PhilippLackner
@PhilippLackner 4 жыл бұрын
Thank you so much 😀
@professorposh4146
@professorposh4146 2 жыл бұрын
Please cover custom coroutine scopes and the differences between that and the built-in ones. Thanks.
@chimezieorji-unegbu7110
@chimezieorji-unegbu7110 3 жыл бұрын
Your videos are very sound. They do what they got to do. Great job!
@Progamingff1
@Progamingff1 10 ай бұрын
Thank you clear explanation ❤
@naruebetphramrit4706
@naruebetphramrit4706 3 жыл бұрын
Amazing series
@ЄвгенійКобахидзе
@ЄвгенійКобахидзе 3 жыл бұрын
Thank you very much for such useful material!
@kryzz1592
@kryzz1592 4 жыл бұрын
When using the MVVM-Pattern. Which scope should be used in a repository when doing network request or reading/writing a database? If we have a viewmodel that calls the repository should we pass the underlying lifecycle and then use this lifecycle as a scope for the coroutine?
@PhilippLackner
@PhilippLackner 4 жыл бұрын
It's not the job of the repository to start the coroutine. Just use suspend functions in the repo and in the viewmodel you execute them with viewmodelscope
@kryzz1592
@kryzz1592 4 жыл бұрын
@@PhilippLackner Thank you!
@thonguyen252
@thonguyen252 3 жыл бұрын
these are very easy to understand videos. I am so appriciate that, so I did press the like button twice..
@haseen5
@haseen5 3 жыл бұрын
Good explanation thanks
@Kunal-jp8tn
@Kunal-jp8tn 2 жыл бұрын
Thank you so much for this awesome series.
@rahulh6711
@rahulh6711 2 жыл бұрын
great video
@rishabhgupta655
@rishabhgupta655 2 жыл бұрын
Thank you ❤️
@bassamnasser7953
@bassamnasser7953 Жыл бұрын
Very helpful ❤
@daniboy943
@daniboy943 2 жыл бұрын
Amazing series of videos, thank you.
@ReyAlexam
@ReyAlexam 3 жыл бұрын
Very clear explanation! keep it up
@droidcasts7350
@droidcasts7350 3 жыл бұрын
really nice example, keep it up
@user-my6yf1st8z
@user-my6yf1st8z Ай бұрын
brilliant
@brucebane7401
@brucebane7401 3 жыл бұрын
amazing bro !!!learning a lot
@denis_artemov
@denis_artemov 3 ай бұрын
great!
@abhishekauti164
@abhishekauti164 3 жыл бұрын
Thanks i got it solved
@pavelb3734
@pavelb3734 4 жыл бұрын
Спасибо
@ganeshjogam7837
@ganeshjogam7837 3 жыл бұрын
Nice work can you please make detail videos regarding scope is created and cancellations and exceptional handling in coroutine.
@larrystreehouse1124
@larrystreehouse1124 Жыл бұрын
Could you also spot out difference between suspend fuction and completedeferred ? 6:24
@ChrisAthanas
@ChrisAthanas 3 жыл бұрын
Very helpful
@mohameddarwish1347
@mohameddarwish1347 4 жыл бұрын
Danke
@PhilippLackner
@PhilippLackner 4 жыл бұрын
Bitte :D
@TheMrAntosiek
@TheMrAntosiek 2 жыл бұрын
Please add more teoretics parts to video
@hades5444
@hades5444 3 жыл бұрын
nice
@AlgeriaHere
@AlgeriaHere 4 жыл бұрын
so lifecyclescope is meant to stick that coroutine to activity lifecyle , if app is ondestroy mode , the coroutine will be dismised as wel to not cause memory leak and for the viewmodelscope is meant to be used with viewmodel as it sticks to viewmodel lifecyle so when viewmodel is cleared , the coroutine is cleared too , but little question , what is the point of having this global scope , like what is the advantage of having it , thank you so much , and as always great video , good work
@PhilippLackner
@PhilippLackner 4 жыл бұрын
Thanks 👍 sometimes you want a coroutine to be alive as long as the app. Imagine doing a calculation that affects your entire app, you don't want to cancel that calculation when you switch the activity
@AlgeriaHere
@AlgeriaHere 4 жыл бұрын
alright yeah so you mean if there is a work that needs to be processed continuously while app is on foreground , in this case global scope is the best choice right
@PhilippLackner
@PhilippLackner 4 жыл бұрын
@@AlgeriaHere yes, you also have to think that kotlin is n ot only for android and PC programs dont usually have a lifecycle, so there GlobalScope is probably used more frequently
@yannism9594
@yannism9594 3 жыл бұрын
@Raunak Nandan Singh Interesting, thanks !
@fatihsevbanuyank594
@fatihsevbanuyank594 2 жыл бұрын
My question is when a Global scope routine finishes it job, does it automatically get deleted from the memory or does it still remain there? Another question is that when the lifecycle scope is finished with the job, does it get deleted as well while the fragment or activity is still operating? Thanks for your response in advance. (Danke schon)
@wolfrudel7624
@wolfrudel7624 2 жыл бұрын
Is it right, that the coroutine holds automatically a reference of the activity from which they were started even if it doesn't use any resources of the activity? So the activity or resources won't be garbage collected even the coroutine use no ressources of the activity?
@Joe-yu9wc
@Joe-yu9wc 3 жыл бұрын
Hi bro, did you have "How to run a coroutine in Service" videos.
@dawoodamir2011
@dawoodamir2011 4 жыл бұрын
Nice vid dude
@PhilippLackner
@PhilippLackner 4 жыл бұрын
Thanks!
@sanskarsharma100
@sanskarsharma100 3 жыл бұрын
Hey, How can you set up onClickListerner without findviewbyId and Viewbinding. I cannot do that in my android studio
@wahyukoco4562
@wahyukoco4562 2 жыл бұрын
may i ask, why you can do click a button (setonclicklistener) inside mainActivity without findViewById?
@wahyukoco4562
@wahyukoco4562 2 жыл бұрын
and if you use viewBinding, we do with binding.btn.setOnClick right? then how can you just type btn.setOnClick?
@FelixEsUnDios
@FelixEsUnDios 2 жыл бұрын
It was an old deprecated method of accessing views without findViewById ,kotlin Synthetics, its deprecated now but I guess it still worked at the time this video was created
@ganeshjogam7837
@ganeshjogam7837 3 жыл бұрын
Can you also create videos about channels and flows in Kotlin
@mujahidansorimajid1524
@mujahidansorimajid1524 2 жыл бұрын
how are you use btnStartActivity without using any view binding?
@kheifs
@kheifs 18 күн бұрын
I couldn't get it too. How...?
@raghavaggarwal8644
@raghavaggarwal8644 3 жыл бұрын
Hi Philipp, in Which thread does the lifecycle scope starts coroutines by default? Can we also use Dispatchers to start the coroutine in specific thread while using lifecycle scope?
@PhilippLackner
@PhilippLackner 3 жыл бұрын
by default it's the main dispatcher. You can change that as with any other scope as well
@raghavaggarwal8644
@raghavaggarwal8644 3 жыл бұрын
@@PhilippLackner but why a scope will start a coroutine in the Main thread? The purpose of Coroutine is to free the main thread right?
@Marcoscsouzads
@Marcoscsouzads 2 жыл бұрын
vídeo muito bom, BR não desista só pq o vídeo está em inglês.
@ManishPatel3030
@ManishPatel3030 4 жыл бұрын
Very neat and clean explanation. Thanks for this video. Do you have twitter account ? I want to share over there
@PhilippLackner
@PhilippLackner 4 жыл бұрын
Thanks man! No currently I don't, I wouldn't know what to post there 😂
@ManishPatel3030
@ManishPatel3030 4 жыл бұрын
@@PhilippLackner Ok when you will have let me know
@codinginflow
@codinginflow 4 жыл бұрын
@@ManishPatel3030 He has one now
@islamicthoughts5030
@islamicthoughts5030 3 жыл бұрын
When calling API by onSwipeRefreshlistener under viewModelScope.launch getting error Job was canceled please help. Thanks
@rp2332
@rp2332 2 жыл бұрын
Sir, what about the coroutine that starts another activity, will it continue to exist even if the task is complete or will it get destroyed with the finish call or with the completion of the code block? Sry if my doubt is too obvious. Please reply and how do you don't need to use findViewById()?
@pranaysaini5648
@pranaysaini5648 Жыл бұрын
in kotlin we don't need findViewById()
@mlktech1531
@mlktech1531 4 жыл бұрын
Thanks for the informations . In the vedio of viewpager 2 how can we make the images show in all screen
@PhilippLackner
@PhilippLackner 4 жыл бұрын
In all screen?
@mlktech1531
@mlktech1531 4 жыл бұрын
I mean full screnn size
@ajaygalagali5963
@ajaygalagali5963 4 жыл бұрын
@@mlktech1531 May be you should set layout height and width of ImageView to "match-parent"
@ajaygalagali5963
@ajaygalagali5963 4 жыл бұрын
:) Thanks
@PhilippLackner
@PhilippLackner 4 жыл бұрын
Welcome!
@ericgoto2459
@ericgoto2459 4 жыл бұрын
How does CoroutineScope fit into this subject?
@ganeshjogam7837
@ganeshjogam7837 3 жыл бұрын
Detailed explanation would have been better about scope
@tejasgalande4557
@tejasgalande4557 2 жыл бұрын
I don't get understand enough :(
Coroutines with Firebase Firestore - Kotlin Coroutines
9:19
Philipp Lackner
Рет қаралды 40 М.
Jobs, Waiting, Cancelation - Kotlin Coroutines
9:32
Philipp Lackner
Рет қаралды 61 М.
小蚂蚁会选到什么呢!#火影忍者 #佐助 #家庭
00:47
火影忍者一家
Рет қаралды 124 МЛН
Friends make memories together part 2  | Trà Đặng #short #bestfriend #bff #tiktok
00:18
НАШЛА ДЕНЬГИ🙀@VERONIKAborsch
00:38
МишАня
Рет қаралды 3,1 МЛН
Coroutine Scopes - Kotlin Coroutines
12:52
Stevdza-San
Рет қаралды 36 М.
The Ultimate Beginner's Roadmap to Android App Architecture
14:58
Philipp Lackner
Рет қаралды 4,6 М.
ViewModels & Configuration Changes - Android Basics 2023
18:46
Philipp Lackner
Рет қаралды 126 М.
The ViewModel & LiveData Tutorial in Android Studio (Kotlin)
8:56
MVVM vs. MVI - Understand the Difference Once and for All
18:40
Philipp Lackner
Рет қаралды 47 М.
95% Don't Understand THIS About Coroutines (Main-Safety)
9:38
Philipp Lackner
Рет қаралды 30 М.
Async and Await - Kotlin Coroutines
7:16
Philipp Lackner
Рет қаралды 81 М.
Kotlin Coroutines 101 - Android Conference Talks
24:49
Android Developers
Рет қаралды 136 М.
小蚂蚁会选到什么呢!#火影忍者 #佐助 #家庭
00:47
火影忍者一家
Рет қаралды 124 МЛН