Saving Data on Android


Using the SQLiteOpenHelper class



Download 19,28 Mb.
Pdf ko'rish
bet60/292
Sana24.01.2022
Hajmi19,28 Mb.
#407089
1   ...   56   57   58   59   60   61   62   63   ...   292
Bog'liq
Bailey J., Dominguez A., Djermanovic D. - Saving Data on Android (1st Edition) - 2019

Using the SQLiteOpenHelper class
SQLiteOpenHelper
 is a helper class designed to help manage database creation and 
version management. To use it, you need to create a subclass of it and implement the 
onCreate

onUpgrade
 and optionally the 
onOpen
 methods. This class will then open 
the database if it exists, create it, if it does not exist, and upgrade it when necessary. 
It does all these things automatically, using the above-mentioned methods.
Now that the constants are in place and you've learned a bit about 
SQLiteOpenHelper
, it's time to create the database and add the CRUD operations.
Open the 
ToDoDatabaseHandler.kt
 file and subclass the 
SQLiteOpenHelper
, by 
adding the following code after the 
class
 declaration:
: SQLiteOpenHelper(context, DATABASE_NAME, 
null

DATABASE_VERSION)
The above code makes the database handler class a subclass of 

Download 19,28 Mb.

Do'stlaringiz bilan baham:
1   ...   56   57   58   59   60   61   62   63   ...   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