How To Use Android’s Preferences DataStore | Android Jetpack Tutorial

Поделиться
HTML-код
  • Опубликовано: 27 ноя 2024

Комментарии • 4

  • @codinginflow
    @codinginflow 2 года назад +2

    "I can finally see what we're doing here" 😂 👌 good one

  • @Sj-yf2jg
    @Sj-yf2jg Год назад +3

    The old Shared Preferences is king 👑.
    Now the datastore & proto store too much boiler code.

  • @AugustinBunani
    @AugustinBunani 11 месяцев назад

    How did you migrate the old sharedPreferences to datastore, how did you map the existing values

  • @LiranBarsisa
    @LiranBarsisa 2 года назад

    I have a few notes:
    1. 4:38 I don't think it's wise to have a field of the editor of the SharedPreferences. I think you should create a new one for each transaction.
    2. Does DataStore finally support Preferences (of settings screens) ? If not, it still can't replace SharedPreferences.
    3. There is no way to use this on Java? I've noticed you used "suspend"...
    4. Is there a way to avoid "suspend" and just use an annotation of "WorkerThread" instead? Or use a liveData? Or something else?
    5. How would you load which theme to use (when there is a setting for it for users), if themes needs to be set right away on the onCreate (otherwise there would be a split second that the wrong background could be shown)? Any nice way to do it via the splash-screen API, perhaps?
    6. 11:49 Why didn't they make such things shorter? It seems about twice as longer compared to SharedPreferences...
    7. It seems you've set "false" as default value twice: once in the viewModel, and another time in the class you've created to hold the values. How come?