Lifecycle events in Jetpack Compose!

  Рет қаралды 2,472

The Android Factory

The Android Factory

Күн бұрын

Compose is awesome, but we did lose some clarity around traditional lifecycle events our Activities and Fragments go through. Follow along as I show you a simple way to listen for these events and do certain actions like make a network call!
Don't forget to subscribe and enable notifications to stay up-to-date!
Docs: developer.andr...
Source code here: github.com/the...
Full playlist here: • Season 11: Jetpack Com...
Jetpack Compose Basics: developer.andr...
=========== Popular Series ===========
Redux e-commerce app: • Season 10: E-commerce ...
Rick and Morty app: • Season 6: Rick & Morty...
=========== Connect with me ===========
LinkedIn: / domenic-polidoro-802b72b4
Instagram: / dom_polidoro
Twitter: / developer_dom
Tiktok: / building_android

Пікірлер: 12
@dadveloper2326
@dadveloper2326 Жыл бұрын
Important to know in case there are things that Compose isn't just taking care of, like it does so often! We must never forget our roots!!
@TheAndroidFactory
@TheAndroidFactory Жыл бұрын
Oh for sure. This effect is especially helpful for hybrid projects that still leverage Activities and Fragments, but have the UI layer in Compose!
@dadveloper2326
@dadveloper2326 Жыл бұрын
@@TheAndroidFactory Yes definitely! hadn't thought of that!
@pigua7705
@pigua7705 Жыл бұрын
The course helped me a lot, thank you for your efforts
@TheAndroidFactory
@TheAndroidFactory Жыл бұрын
Woo! Thanks for watching, glad it helped :)
@soontaek
@soontaek Жыл бұрын
Thank you. I subbed :D
@TheAndroidFactory
@TheAndroidFactory Жыл бұрын
Hey happy it helped :)
@TheAndroidFactory
@TheAndroidFactory Жыл бұрын
Thanks for the support!
@rahulchandrabhan
@rahulchandrabhan 24 күн бұрын
Nice one
@TheAndroidFactory
@TheAndroidFactory 23 күн бұрын
Thank you!
@ubersticks
@ubersticks Жыл бұрын
The performOnLifecycle() is an interesting way to handle this. Is there a reason to favor that over LaunchedEffect(Unit) { viewModel.fetchQuoteOfTheDay() } ??
@TheAndroidFactory
@TheAndroidFactory Жыл бұрын
Great question -- from what I understand the LaunchedEffect is a tiny bit more limiting. The performOnLifecycle idea enables the code to hook into different traditional lifecycle events like we would normally have available to us in Fragments. So, for instance, I don't believe LaunchedEffect would run again if you background the app and bring the app into the foreground again, whereas the performOnLifecycle would inside the `onResume` lambda. So, in this implementation, we are refreshing the quote of the day any time the Activity is resumed. They both are useful tools and, in this case, I think either approach is fine! Let me know your thoughts
Functional Programming Intro -- Android 2023
19:07
The Android Factory
Рет қаралды 821
Jetpack Compose + Coil image loading tutorial
14:17
The Android Factory
Рет қаралды 2,3 М.
Офицер, я всё объясню
01:00
История одного вокалиста
Рет қаралды 3,9 МЛН
Full Guide to Jetpack Compose Effect Handlers
24:56
Philipp Lackner
Рет қаралды 94 М.
Jetpack Compose: Debugging recomposition
7:29
Android Developers
Рет қаралды 30 М.
Side Effects & Effect Handlers - Android Jetpack Compose - Part 10
14:29
Setup Ktor for your Android app!
15:22
The Android Factory
Рет қаралды 5 М.
10 - State & ReComposition - Jetpack Compose - Android Studio
9:57
Mohsen Mashkour
Рет қаралды 1,1 М.
Practical API mapping Android example
11:14
The Android Factory
Рет қаралды 1,9 М.
Let's Migrate an XML Project to Jetpack Compose!
15:49
Philipp Lackner
Рет қаралды 25 М.
Офицер, я всё объясню
01:00
История одного вокалиста
Рет қаралды 3,9 МЛН