Saving Data on Android


db  package and name it  migrations



Download 19,28 Mb.
Pdf ko'rish
bet187/292
Sana24.01.2022
Hajmi19,28 Mb.
#407089
1   ...   183   184   185   186   187   188   189   190   ...   292
Bog'liq
Bailey J., Dominguez A., Djermanovic D. - Saving Data on Android (1st Edition) - 2019

db
 package and name it 
migrations
.
Inside 
migrations
, create a new class and name it 
Migration1To2
. Make your class 
extend 
Migration
 like this:
class
 
Migration1To2
 : 
Migration
(1, 2) { 
}
The first parameter in the constructor represents the start version of the database. 
The second one represents the end version after you've applied this migration.
Next, press 
Control + I
 (
implement methods
) so Android Studio displays all missing 
members. Select all of them and press 
OK
. Your class should now have a 
migrate()
 
method:
class
 
Migration1To2
 : 
Migration
(
1

2
) { 
  
override
 
fun
 
migrate
(database: SupportSQLiteDatabase)
 { 
    TODO(
"not implemented"

//To change body of created 
functions use File | Settings | File Templates.
 
  } 
}
Inside 
migrate()
, you should execute all the queries you need to properly change 
the database schema to the version indicated in the constructor.
Now, since the change is a very simple one, you'll only need to execute a single 

Download 19,28 Mb.

Do'stlaringiz bilan baham:
1   ...   183   184   185   186   187   188   189   190   ...   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