Тёмный

A Compose state of mind: Using Jetpack Compose's automatic state observation 

Android Developers
Подписаться 1,3 млн
Просмотров 63 тыс.
50% 1

Опубликовано:

 

15 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 36   
@ZeDzszedl
@ZeDzszedl 3 года назад
Very good video. Docs on state hoisting in compose are lacking real life examples and this video clarify some concepts. Thanks!
@arjangap2551
@arjangap2551 Год назад
Amazing video. He has a deep understanding of the subject and because of that he can transform his knowledge. Give him a raise ❤
@HaSeebpjr01
@HaSeebpjr01 8 месяцев назад
Every important aspects of compose in one video, excellent work and clear explanations. Thank you so much ❤❤
@purpledaysable
@purpledaysable 2 года назад
Yes. Absolutely- and as usual, you've helped me enter "A Compose State Of Mind".... Thank You for walking me through, as running through important steps is always a waste of time.
@AriAp-mh3bf
@AriAp-mh3bf Год назад
Amazing presentation. one of the best I've seen from Android Developers channel. please make more videos like this.
@DavidNitzscheBell
@DavidNitzscheBell Год назад
parts of this are useful, but many more are not explained enough or with real examples. very convoluted. hopefully the codelab will make stuff clearer.
@reyalfiesenajon7908
@reyalfiesenajon7908 Год назад
salamat ss palabas na ito ang ganda pakingan
@chitho1987
@chitho1987 Год назад
17:58 He means the DI library Hilt not Field
@mikeshilovski1512
@mikeshilovski1512 2 года назад
awesome presentation, thanks a lot
@hugovelarde288
@hugovelarde288 Год назад
If I want to tracked an image not a number, how do I do?
@tripabroad8918
@tripabroad8918 2 года назад
Preview isn't drawn when viewModel has some params. Did anyone have this issue?
@gmk57
@gmk57 2 года назад
Passing parameters to remember() (see code around 14:00) means that JetsnackAppState will be reset whenever any of its dependencies changes, right? It also won't survive configuration change or process recreation. Can lead to bugs if JetsnackAppState contains its own (not derived from dependencies) state.
@manuelvicnt
@manuelvicnt 2 года назад
Hi! Yeah, that's the idea, generally, you want to recreate the state holder if the dependencies change. If you don't do that, you might be using old instances of certain types that could potentially lead to memory leaks. As mentioned in your other comment, use `rememberSaveable` to make state survive config changes or process recreation
@NguyenTran-uv6mu
@NguyenTran-uv6mu 2 года назад
I 'm still confusing about UI-element state vs screen state
@AndroidDevelopers
@AndroidDevelopers 2 года назад
Hello, Nguyên! Take a look at the link below for more information about UI layers. goo.gle/3uXxOTP We hope this helps!
@gmk57
@gmk57 2 года назад
When LazyList's scroll position and expanded items are stored in CartState (19:09), they will be cleared on navigating to another screen & back, correct? That won't look good from UX perspective.
@manuelvicnt
@manuelvicnt 2 года назад
You can `rememberSaveable` CartState if there's data you want to preserve across process and activity recreation
@gmk57
@gmk57 2 года назад
@@manuelvicnt Thanks for clarification. But fragment's view is also destroyed while in the back stack, AFAIK. What about Compose & its state?
@remerico
@remerico 2 года назад
@@gmk57 Compose rememberSaveable states are saved on the Fragment/Activity saved instance bundle, on the same place where onSaveInstanceState is used
@demauromark
@demauromark 2 года назад
“Simplicity is the soul of efficiency.” - Austin Freeman. It would be great if you show some coding tutorials to clearly understand the concepts.
@pigua7705
@pigua7705 Год назад
Good job
@Mrdresden
@Mrdresden 2 года назад
Great stuff! These tutorials are essential for getting into this complete new way of doing things. So plz keep it up
@SAMathlete
@SAMathlete 2 года назад
I'm excited to learn this framework so that I too can charge people $12.99 for an ice cream sandwich.
@gmk57
@gmk57 2 года назад
Is it a good idea to call collectAsState() inside a composable function (17:05)? This conversion function will be re-executed on every recomposition.
@manuelvicnt
@manuelvicnt 2 года назад
Hello! `collectAsState` is remembered and it's not re-executed on every recomposition. New values emitted into the flow will cause recompositions though. Hope this clarifies few things!
@eliazarcampos3202
@eliazarcampos3202 2 года назад
@@manuelvicnt por que
@eliazarcampos3202
@eliazarcampos3202 2 года назад
Kaon sc7210
@remerico
@remerico 2 года назад
The composable function will only be recomposed when the collectAsState() value changes, Compose is smart enough to skip recomposing parts of the UI where the states did not change.
@dp1927
@dp1927 2 года назад
All I want is the nav controller availability in vm :(
@reyalfiesenajon7908
@reyalfiesenajon7908 Год назад
its ok
@rubyh4184
@rubyh4184 2 года назад
This doesnt seemed to follow OOP principle at all with all those remember keywords. It is a function that magically store state somewhere you dont know using remember keyword. Flutter does this cleanly with widget as object instead of function.
@NohusBluxome
@NohusBluxome 2 года назад
Compose is not OO, it's declarative programming. OOP principles are irrelevant here.
@remerico
@remerico 2 года назад
Compose is comparable to using XML / Data binding, UI frameworks do not benefit at all from object-oriented programming. I'm glad Google realized this and made Compose fully declarative. You might have a point with the "magic" remember keyword, but you do not have to use it, just can also put your state in a view model, it is only a convenience feature to make things simpler.
@firstnamelastname-oy7es
@firstnamelastname-oy7es Год назад
The code passed in the lambda to the remember function is executed only on initial composition, and not in re-composition, unless the any of the optional key parameters to the remember function have changed, which will cause the lambda to be re-executed.
@mubaraknative
@mubaraknative 4 месяца назад
OOP is not a principal tho, it is a one type of paradigm in a programming languages
@赵梦-k5x
@赵梦-k5x 2 года назад
牛蛙牛蛙
Далее
Deep dive into Jetpack Compose layouts
28:25
Просмотров 60 тыс.
State holders and state production in the UI Layer
20:53
КТО БОИТСЯ КЛОУНОВ?? #shorts
00:20
Просмотров 561 тыс.
More performance tips for Jetpack Compose
20:47
Просмотров 40 тыс.
Understanding Compose (Android Dev Summit '19)
36:15
Просмотров 72 тыс.
The Top 3 State Management Mistakes On Android
14:30
Просмотров 25 тыс.
Full Guide to Jetpack Compose Effect Handlers
24:56
Просмотров 95 тыс.
State in Jetpack Compose
43:46
Просмотров 73 тыс.
Room в Jetpack Compose | Android Studio + Kotlin
1:05:54
Advanced state and side effects in Jetpack Compose
41:21