DON'T Update Your UI Like THIS In Compose

Follow for more Android & Kotlin tips 🙌

Пікірлер: 27

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

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

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

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

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

  • @amanverma6515
    @amanverma65152 ай бұрын

    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
    @Mreto172 ай бұрын

    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