Saving Data on Android



Download 19,28 Mb.
Pdf ko'rish
bet168/292
Sana24.01.2022
Hajmi19,28 Mb.
#407089
1   ...   164   165   166   167   168   169   170   171   ...   292
Bog'liq
Bailey J., Dominguez A., Djermanovic D. - Saving Data on Android (1st Edition) - 2019

Separation of Concerns
: Activities and fragments usually have to execute 
different operations such as database transactions, HTTP requests, UI updates and 
more. It is better to separate 
View
s from the business logic by delegating this task 
to a more appropriate class such as the 
ViewModel
s.
But how does the ViewModel help solve these issues?
Well, 
ViewModel
 is specifically designed to hold and manage data related to your 
user interface. Just like 
LiveData
 the 
ViewModel
 is lifecycle aware, which means that 
it can react to the state of your Android components. Furthermore, using factories, 
and dependency management, it can survive configuration changes such as screen 
rotations. Therefore you won't need to manually restore data using methods such as 
onSaveInstanceState()
, you can simply retrieve everything you stored within the 
ViewModel
.
Saving Data on Android Chapter 9: Using Room with Google's Architecture Components
raywenderlich.com
155


The 
ViewModel
 sounds like the perfect choice to manage the questions and answers 
for your DroidQuiz app, right?
You should find a package under 

Download 19,28 Mb.

Do'stlaringiz bilan baham:
1   ...   164   165   166   167   168   169   170   171   ...   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