DON'T Update Your UI Like THIS In Compose

  Рет қаралды 25,048

Philipp Lackner

Philipp Lackner

Жыл бұрын

Follow for more Android & Kotlin tips 🙌

Пікірлер: 28
@MrSN99
@MrSN99 Жыл бұрын
All my homies are collecting state in the activity itself
@martinseal1987
@martinseal1987 Жыл бұрын
Kotlin and android Dev is getting out of hand everything you do comes with 10 gotchas
@CommanderSteps
@CommanderSteps Жыл бұрын
Deine Shorts sind super!
@PhilippLackner
@PhilippLackner Жыл бұрын
Danke!
@justloveandpeace4010
@justloveandpeace4010 Жыл бұрын
Awesome bro
@abdullqadirbarznji1149
@abdullqadirbarznji1149 Жыл бұрын
Thanks man
@josema2702
@josema2702 Жыл бұрын
eres un fenomeno primo
@freshtechtips
@freshtechtips Жыл бұрын
A complete new dependencies just to do simple core things?? Like new dependency just for extention functions for suspend instead of callback I know it because of kotlin support and java the main one, but why not make single dependency for kotlin for all that things instead of kotlin support dependency for every core feature like coroutines I think android team should think in better way
@PhilippLackner
@PhilippLackner Жыл бұрын
Because kotlin != android
@mohegyux4072
@mohegyux4072 Жыл бұрын
I thought any state is discarded once the composable is disposed of !
@PhilippLackner
@PhilippLackner Жыл бұрын
The state is, but the underlying flow will still run because collectAsState will not cancel it when the app goes in the background
@alihamad7958
@alihamad7958 15 күн бұрын
I dont understand why jetpack Compose developers dont just use mutableStateOf in ViewModel so we dont need to use collect at UI
@malikkissoum730
@malikkissoum730 Жыл бұрын
ok I have a question. When ur app then goes to the foreground after being in the background, this thing gets notified and update the state, how can I prevent this ? Say I have a snackbar that I have already shown, and i don't wan to show it anymore when the app goes to the foreground
@dennispetcu8383
@dennispetcu8383 Жыл бұрын
Dismiss the snackbar in onPause
@_0_o_924
@_0_o_924 Жыл бұрын
Shared flow?
@khiariyoussef3226
@khiariyoussef3226 Жыл бұрын
@Philipp there is a question that came up in my mind when I was dealing with saving UI state, should we use rememberSaveable or ViewModel's saved state handle? 🤔
@WellingtonFerreiraTon
@WellingtonFerreiraTon Жыл бұрын
If you don't mind me trying to help, I guess rememberSaveable is better to use when we want a ui state that is intrinsically connected to composable (for example, an expandable text, to keep if it's expanded or not even after configuration changes); and UI logic that relates to business logic we can keep on view model (for example, when we populate a list of users to a composable from request or database). I hope it helps. (If i wrote anything wrong please let me know, english is not my native language)
@khiariyoussef3226
@khiariyoussef3226 Жыл бұрын
@@WellingtonFerreiraTon Thanks for the reply, but i don't agree on the second statement about using savedstatehandle for saving lists, it is not recommended (according to the docs), we could use a local database for that.
@WellingtonFerreiraTon
@WellingtonFerreiraTon Жыл бұрын
@@khiariyoussef3226 sorry I was speaking about state management on the second statement, not about saved state handle. My bad! I think the most frequent use case for saved state handle is to get arguments defined through navigation. Google reccomends to use view model mostly for UI logic that depends on business logic. If possible the best approach is to have a state class to handle most complex use cases that don't rely on business logic. I hope I got this right. Thanks for your input :)
@WellingtonFerreiraTon
@WellingtonFerreiraTon Жыл бұрын
Just a little addendum, view model is also reccomended for screen logic.
@amanverma6515
@amanverma6515 3 ай бұрын
Why this is not default?
@phamquangtrung8425
@phamquangtrung8425 Жыл бұрын
How to automatically allow access(grant permission)usb serial on android?
@frenchp5435
@frenchp5435 Жыл бұрын
no hacking! _bad_ hackerman Vietnam
@Mreto17
@Mreto17 3 ай бұрын
Ekspresine biasa wae
@my_love_sanatan
@my_love_sanatan Жыл бұрын
Day by day Android developement is losing its popularity by this complex things
@CommanderSteps
@CommanderSteps Жыл бұрын
It actually just got easier with this library.
@serpenheir
@serpenheir Жыл бұрын
Complex things and concepts allow to create versatile software and API. If someone quits from Android development due to "complex" things like this, they've never been an accomplished engineer at first.
@my_love_sanatan
@my_love_sanatan Жыл бұрын
People are shifting to react nowadays just because of complexities Android day by day
MVVM vs. MVI - Understand the Difference Once and for All
18:40
Philipp Lackner
Рет қаралды 36 М.
Should You Use Compose State or StateFlow in Your ViewModels?
13:59
Philipp Lackner
Рет қаралды 74 М.
1,000 Diamonds! (Funny Minecraft Animation) #shorts #cartoon
00:31
toonz CRAFT
Рет қаралды 41 МЛН
Double Stacked Pizza @Lionfield @ChefRush
00:33
albert_cancook
Рет қаралды 120 МЛН
3 Clean Code Hacks I Bet You Didn't Know (Kotlin & Android)
12:30
Philipp Lackner
Рет қаралды 26 М.
Jetpack Compose. Основы. State [Ru, Kotlin\Android]
33:21
Mobile Developer
Рет қаралды 26 М.
Jetpack Compose Made Easy: User Input, State, and Lifecycle Explained!
12:01
How principled coders outperform the competition
11:11
Coderized
Рет қаралды 1,6 МЛН
THIS Compose-State Mistake Leads to Problems In Your Code
7:58
Philipp Lackner
Рет қаралды 40 М.
The Story of Next.js
12:13
uidotdev
Рет қаралды 560 М.
You're Collecting Your Flows Wrong In Compose | THIS Is Why
11:35
Philipp Lackner
Рет қаралды 27 М.
1,000 Diamonds! (Funny Minecraft Animation) #shorts #cartoon
00:31
toonz CRAFT
Рет қаралды 41 МЛН