You are on page 1of 1

Chapt

er6:
SAQ

1
.Whent
heus
eruni
nst
all
syourapp,
whathappenst
othef
il
ess
tor
edwi
tht
hist
ypeofs
tor
age?

•Thef i
l
eskepti
napp-s
peci
fi
cs t
oragearedel
etedwhenauseruninst
all
syourapp.Becauseof
thi
s,youshoul
dn'
tus
ethiss
toragetosaveanythi
ngthatt
heuserexpect
stolastbeyondyour
program.

2.
Wr i
teasampl
esyntaxtoclearal
lthevaluesi
ntheshar
edpref
erencesf
il
e,cal
lthecl
ear
()
methodonthes
haredprefer
enceseditorandappl
ythechanges
.

•Shar
edPrefer
ences.
Edit
orpref
erencesEdi
tor=mPref
erences
.edi
t(
);
pr
efer
encesEdi
tor
.putI
nt(
"number"
,4);
pr
efer
encesEdi
tor
.cl
ear(
);
pref
erencesEdi
tor
.appl
y()
;

3.
Explai
nthepr
efer
enceAct
ivi
tycl
assi
nyourownwor
ds.
Howdoesi
tdi
ff
erf
rom Act
ivi
tybas
e
cl
ass
?

•Thebas i
cclassforanacti
vi
tythatshowst heuserahierarchyofuserpr eferencesis
Pref
erenceActi
vi
ty.I
t'
salotli
ketheAc t
ivi
tybaseclas
s.PreferenceActi
vity,ont heotherhand,
behavesinauniqueway. Thepresentati
onofprefer
encesi navisualstylethatresembles
syst
em prefer
encesisoneofthemos tessenti
alel
ementst hatthePreferenceAct i
vi
tymanages .

4.
Wri
tet
hes
ynt
ax/
quer
yincr
eat
ingat
abl
einSQLi
te.

•SQLi
teDat
abas
emydat
abas
e=openOr
Creat
eDat
abas
e("
Sampl
eDat
abas
e",
.

MODE_
PRI
VATE,
nul
l
);

5.
Lis
tandbr
ief
lyex
plai
nal
lthemet
hodsyouneedt
oover
ri
dei
ntheCont
entPr
ovi
dercl
ass
.

•onCr
eat
e()-Thi
smet
hodi
scal
l
edwhent
hepr
ovi
deri
slaunched.

•quer
y()-Thi
smet
hodhandl
escl
i
entr
eques
ts.
Ther
esul
tisr
etur
nedi
nthef
orm ofacur
sor
obj
ect
.

•i
nser
t()-Thi
smet
hodi
nser
tsanewr
ecor
dint
othecont
entpr
ovi
der
.

•del
ete(
)-Removesanex
ist
ingr
ecor
dfr
om t
hecont
entpr
ovi
der
.

•updat
e()-Thi
smet
hodupdat
esanex
ist
ingr
ecor
dofacont
entpr
ovi
der
.

•get
Type(
)-Thi
sfunct
ionr
etur
nst
heMI
MEt
ypeoft
hedat
aatt
hes
peci
fi
edURI
.

You might also like