Saving Data on Android


Note : They are also the location where app  Preferences



Download 19,28 Mb.
Pdf ko'rish
bet44/292
Sana24.01.2022
Hajmi19,28 Mb.
#407089
1   ...   40   41   42   43   44   45   46   47   ...   292
Bog'liq
Bailey J., Dominguez A., Djermanovic D. - Saving Data on Android (1st Edition) - 2019

Note
: They are also the location where app 
Preferences
 are saved. However, 
the two should not be confused with one another.
The first step to using 
SharedPreferences
 is obtaining a reference to the app—
specific file, let's see how to do that!
GeTng a reference to the 
SharedPreferences file
Depending on how you want to use 
SharedPreferences
, there are different ways to 
access or create the 
SharedPreferences
 file:

getSharedPreferences()
 can be called from any 
Context
 in your app and allows 
you to specify a name for the file. It is handy if you need multiple 
SharedPreferences
 files with different names.

getPreferences()
 is called from an 
Activity
 and does not allow you to specify a 
file name because it uses the default class name of that 
Activity
. It is handy if 
you need to create different preference files for different activities.

getDefaultSharedPreferences()
 is used for app settings and preferences at the 
app level
, and returns the default prefs file for the entire app. You can use this to 
store data that is useful for your entire app, or features you set up every time a 
user starts your app.
But getting preferences is only half of the work. You still need to read and write data 
to the prefs.

Download 19,28 Mb.

Do'stlaringiz bilan baham:
1   ...   40   41   42   43   44   45   46   47   ...   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