mgolokhov / dodroid

May the knowledge be with you!
MIT License
20 stars 12 forks source link

Nuke deprecated Loaders and introduce ViewModel #114

Closed mgolokhov closed 5 years ago

mgolokhov commented 5 years ago

"Loaders have been deprecated as of Android P (API 28). The recommended option for dealing with loading data while handling the Activity and Fragment lifecycles is to use a combination of ViewModels and LiveData. ViewModels survive configuration changes like Loaders but with less boilerplate. LiveData provides a lifecycle-aware way of loading data that you can reuse in multiple ViewModels. You can also combine LiveData using MediatorLiveData , and any observable queries, such as those from a Room database, can be used to observe changes to the data. ViewModels and LiveData are also available in situations where you do not have access to the LoaderManager, such as in a Service. Using the two in tandem provides an easy way to access the data your app needs without having to deal with the UI lifecycle. To learn more about LiveData see the LiveData guide and to learn more about ViewModels see the ViewModel guide."

Source: https://developer.android.com/guide/components/loaders

mgolokhov commented 5 years ago

resolved in https://github.com/mgolokhov/dodroid/pull/122