Saving Data on Android


Using LiveData with a repository



Download 19,28 Mb.
Pdf ko'rish
bet160/292
Sana24.01.2022
Hajmi19,28 Mb.
#407089
1   ...   156   157   158   159   160   161   162   163   ...   292
Bog'liq
Bailey J., Dominguez A., Djermanovic D. - Saving Data on Android (1st Edition) - 2019

Using LiveData with a repository
To use 
LiveData
, you first need to learn what a 
LiveData
 is. To put it simply, 
LiveData
 is an 
observable piece of data
, which is 
aware of the Android lifecycle

You could, for simplicity's sake, think of an 
Observable
 from Reactive Extensions, 
but which also listens to the Android lifecycle. As such, you can listen to its updates, 
by adding 
Observer
s.
Furthermore, by knowing the lifecycle state at all times, it has smart internal 
mechanisms, which stop potential observers from being updated, unless the lifecycle 
is 
active
 — your app and the screen with 
LiveData
s is visible. Because of this, you 
can easily avoid updating the UI, when the app is not active — e.g. when it's in the 
background.
Saving Data on Android Chapter 9: Using Room with Google's Architecture Components
raywenderlich.com
150


According to the documentation, there are six main advantages of using 
LiveData
 vs 
other similar libraries:


Download 19,28 Mb.

Do'stlaringiz bilan baham:
1   ...   156   157   158   159   160   161   162   163   ...   292




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish