Vous êtes sur la page 1sur 50

!"# - !"#$%&# ()*)+%,-)". /"*&$%"-)".

"#$$%&' () $*# +,-. /0#1$%&'. 2(&&%&' 1&3 ,#4(''%&' 56(0 7%08$ +))9%:1$%6&
Cb ect| ves:
lamlllarlze yourself wlLh Lhe Androld uevelopmenL LnvlronmenL
!"#$%&'(& *$&+, 1hls class has many sLudenLs wlLh a wlde range of prevlous experlence. Some sLudenLs
are falrly new Lo ob[ecL-orlenLed (CC) programmlng. Some have CC programmlng experlence, buL are
new Lo Androld. SLlll oLhers know some Androld already, and wanL Lo [usL freshen up Lhelr knowledge.
8ecause of Lhls, l'm noL expecLlng LhaL everyone can flnlsh Lhls enLlre lab. l suggesL LhaL you seL a Llme
llmlL for yourself, say 1 hour. Work Lhrough whaL you can ln LhaL Llme and Lhen sLop and Lake a break. lf
you laLer feel LhaL you have some more Llme for Lhls Lab, Lhen repeaL Lhe process. Agaln - don'L feel
LhaL you need Lo flnlsh everyLhlng ln Lhls lab. 1haL's noL Lhe goal here.
Speclflcally, lf you are falrly new Lo programmlng, you should Lry Lo compleLe arLs 1 - 4 below. lf you
are famlllar wlLh programmlng and programmlng envlronmenLs, you should Lry Lo compleLe parLs 1 - 6
below. lf you're an experlenced programmer and reasonably comforLable wlLh !ava, Lry Lo do Lhe whole
Lhlng.
1hls lab conLalns Lhe followlng arLs.
1. SeL up Lhe Androld Suk.
2. CreaLe a new Androld appllcaLlon.
3. CreaLe an Androld vlrLual uevlce and sLarL Lhe Androld LmulaLor.
4. 8un Lhe appllcaLlon you creaLed ln arL 2.
3. lmporL an appllcaLlon pro[ecL.
6. uebug an Androld appllcaLlon.
7. lurLher explore Lhe luL
AddlLlonal helpful lnformaLlon can be found on Lhe Androld ueveloper webslLe:
hLLp://developer.androld.com/sdk/lnsLalllng/bundle.hLml
hLLp://developer.androld.com/Lralnlng/baslcs/flrsLapp/creaLlng-pro[ecL.hLml
hLLp://developer.androld.com/Lools/devlces/managlng-avds.hLml
hLLp://developer.androld.com/Lralnlng/baslcs/flrsLapp/runnlng-app.hLml






2
lat 1 - Sett| ng bo 1|e SLl.
ln Lhls parL you wlll download and lnsLall Lhe Androld Suk and sLarL Lhe Lcllpse lnLegraLed uevelopmenL
LnvlronmenL (luL).
1. uownload Lhe Suk from hLLp://developer.androld.com/sdk/lndex.hLml. 8emember where you
save Lhe downloaded flle.


2. uouble-cllck on Lhe zlp flle you [usL downloaded Lo exLracL Lhe zlp flle's conLenLs.











3

3. (CpLlonal) uslng Wlndows Lxplorer, drag and drop Lhe Au1 8undle folder Lo any locaLlon you
deslgnaLe.


Assumlng you have Lhe !ava uevelopmenL klL lnsLalled on your compuLer, you should now be
able Lo use Lhe Androld Suk. lf you do noL have Lhe uevelopmenL klL lnsLalled, see:
hLLp://www.oracle.com/LechneLwork/[ava/[avase/downloads/[dk7-downloads-1880260.hLml
for more lnformaLlon.

4. SLarL Lhe Lcllpse lnLegraLed uevelopmenL LnvlronmenL (luL). 8egln navlgaLlng Lo Lhe Lcllpse
appllcaLlon by double-cllcklng on Lhe Au1 8undle folder.





4
3. nexL, double-cllck on Lhe ecllpse folder.



6. nexL, double-cllck on Lhe ecllpse appllcaLlon lcon.






3
7. As Lcllpse sLarLs, Lhe Androld ueveloper 1ools splash screen wlll appear.



8. Lcllpse wlll ask you Lo choose Lhe locaLlon of your workspace. lf you would llke LhaL workspace
Lo be Lhe defaulL from now on, selecL Lhe approprlaLe checkbox.






6

9. AL Lhls polnL you should see Lcllpse open. 1he flrsL Llme lL opens you may see a Welcome screen,
such as Lhe one shown below.


-./'(0+. 1 234(5 6'%.7'%+ -00+8+%'&4$(9 :&;.+(& <. =9 remlnded me Lo menLlon Lhe lnLel Pardware
AcceleraLed LxecuLlon Manager (PAxM). lf compaLlble wlLh your developmenL machlne, lnsLalllng
PAxM wlll greaLly speed up Lhe emulaLor, maklng your developmenL, LesLlng and debugglng much more
producLlve. PAxM ls bundled wlLh Lhe Au1, and also avallable for download separaLely.
See Lhe followlng llnks for more lnformaLlon:
hLLp://developer.androld.com/Lools/devlces/emulaLor.hLml#acceleraLlon for a compleLe descrlpLlon.
AbouL: hLLp://sofLware.lnLel.com/en-us/arLlcles/speedlng-up-Lhe-androld-emulaLor-on-lnLel-
archlLecLure
uownloads: hLLp://sofLware.lnLel.com/en-us/arLlcles/lnLel-hardware-acceleraLed-execuLlon-manager





7
lat 2 - Ceat| ng A lew lo ect
ln Lhls parL you wlll creaLe a slmple Androld appllcaLlon LhaL dlsplays Lhe words, Pello World!"
1. lrom Lhe appllcaLlon menu bar, selecL llle > new > Androld AppllcaLlon ro[ecL

2. nexL, a dlalog box wlll appear, allowlng you Lo enLer an AppllcaLlon name. LnLer Lhe sLrlng,
MyllrsLApp." 1he ro[ecL name and ackage name flelds wlll flll ln auLomaLlcally. Leave Lhe
remalnlng seLLlngs alone and Lhen cllck nexL.






8
3. nexL, a new dlalog box wlll appear. ueselecL CreaLe cusLom launcher lcon," as we wlll noL be
creaLlng a cusLom lcon for Lhls app. 1hen cllck nexL.

4. ln Lhe nexL wlndow, leave all Lhe seLLlngs as defaulL. 1hen cllck nexL.







9
3. lor Lhe nexL wlndow, also leave all defaulL seLLlngs ln place and press llnlsh.


6. nexL, llnd and press Lhe resLore lcon on Lhe lefL Lo brlng Lhe maln edlLlng wlndow up.







10
7. AL Lhls polnL, your screen should look slmllar Lo Lhe one below. Cpen Lhe MalnAcLlvlLy.[ava flle
Lo see Lhe code LhaL seLs up Lhe Maln AcLlvlLy of your new app.


8. under acLlvlLy_maln.xml, ls Lhe xml flle assoclaLed wlLh Lhe layouL of your Maln AcLlvlLy. lf you
cllck on Lhe Craphlcal LayouL Lab, you can see words, Pello world!" appearlng on Lhe AcLlvlLy's
user lnLerface.


ln parL 4 we wlll show you how Lo run Lhls app ln Lhe Androld LmulaLor.





11
lat 3 - bs| ng t|e Lmu| ato
ln Lhls parL you wlll learn how Lo seL up and use Lhe Androld LmulaLor.
1. llrsL sLarL up Lhe Androld vlrLual uevlce Manager. ?ou can do LhaL by selecLlng Wlndow >
Androld vlrLual uevlce Manager from Lhe Lcllpse menu bar.

2. A new dlalog box wlll pop up. Cllck new" Lo creaLe a new Androld vlrLual uevlce (Avu).






12
3. AnoLher dlalog box wlll pop up dlsplaylng varlous Avu parameLers. ?ou can play wlLh Lhese
parameLers Lo creaLe dlfferenL vlrLual devlces. ress Ck" Lo flnlsh.

4. A new Avu wlll now be llsLed ln Lhe Avu Manager wlndow. SelecL lL and Lhen press Lhe SLarL
buLLon.







13
3. A new dlalog box wlll pop up. ress Lhe Launch buLLon Lo sLarL Lhe emulaLor.


6. As Lhe emulaLor sLarLs up, you wlll see anoLher dlalog box. Launch errors wlll be dlsplayed here.







14
7. nexL, 1he emulaLor wlll appear and sLarL lLs booL sequence.

8. AfLer Lhe devlce has booLed, Lhe emulaLor wlll be ready for user lnLeracLlon.




13
lat 4 - 8unn| ng ?ou l| st Aoo
ln Lhls parL you wlll learn how Lo run Lhe appllcaLlon you creaLed ln arL 2 ln Lhe Androld LmulaLor.
1. 8eLurn Lo Lcllpse and rlghL-cllck your app's pro[ecL name. lrom Lhere selecL 8un As > Androld
AppllcaLlon.

2. ln Lhe Console panel, below Lhe edlLlng wlndow, you wlll see ouLpuL lndlcaLlng LhaL Lhe
appllcaLlon ls belng loaded onLo Lhe Androld LmulaLor.






16

3. 8eLurn Lo your LmulaLor lnsLance. lf neessary, drag Lhe lock lcon Lo unlock your devlce.


4. ?ou should now see your appllcaLlon, runnlng ln Lhe Androld LmulaLor.





17
lat S - l moot| ng ano 8unn| ng an Lx| st| ng Aoo| | cat| on
ln Lhls parL you'll learn Lo lmporL a pre-exlsLlng appllcaLlon lnLo Lcllpse and Lhen run lL.
1. uownload Lhe 1heAnswer appllcaLlon.
2. LxLracL Lhe conLenLs of Lhe Lxample App Lo any folder. 1he conLenLs should conLaln
a sample pro[ecL conLalned wlLhln a folder.

3. 8eLurn Lo Lcllpse. SelecL llle > lmporL from Lhe menu bar Lo lmporL Lhe appllcaLlon
pro[ecL.






18
4. nexL, ln Lhe dlalog box LhaL appears, selecL Androld > LxlsLlng Androld Code lnLo
Workspace, and Lhen press Lhe nexL 8uLLon.

3. nexL, you'll see a dlalog box, allowlng you Lo selecL Lhe pro[ecL Lo lmporL. ress Lhe
8rowse. 8uLLon.




19
6. SelecL Lhe locaLlon of Lhe Lxample AppllcaLlon conLenLs, and press Ck.

7. ln Lhe nexL dlalog box, make sure LhaL you selecL Copy pro[ecLs lnLo workspace"
and Lhen cllck Lhe llnlsh 8uLLon.






20
8. AL Lhls polnL Lhe appllcaLlon should appear ln Lhe ro[ecL Lxplorer on Lhe lefL slde of
Lhe luL.


9. 8lghL-cllck Lhe folder go Lo 8un As > Androld AppllcaLlon





21
10. 1he Androld LmulaLor wlll now open up and run Lhe example appllcaLlon.







22
lat 6 - Lebugg| ng
ln Lhls parL of Lhe lab you wlll learn how Lo use Lhe Lcllpse debugger Lo debug Lhe 1heAnswer
appllcaLlon you lmporLed ln SLep 3.
1. uouble-cllck Lhe 1heAnswer.[ava flle under src > course.examples.Lheanswer

2. nexL, open Lhe uebugglng erspecLlve by selecLlng Wlndow > Cpen erspecLlve >
uebug from Lhe menu bar.





23
3. A new perspecLlve wlll appear, slmllar Lo LhaL shown below.

4. Cn Lhls screen, double cllck Lhe hlghllghLed blue area nexL Lo Lhe llne:
lnL val = flndAnswer(),"





24
3. A new breakpolnL wlll be placed aL LhaL llne, lndlcaLed by Lhe small clrcle LhaL now
appears ln Lhe hlghllghLed blue area Lo Lhe lefL of Lhe LexL.


6. nexL, press Lhe uebug lcon aL Lhe Lop of Lhe wlndow ln Lhe menu bar Lo sLarL
debugglng Lhe appllcaLlon.






23
7. ?our LmulaLor should have loaded Lhe App and sLopped before Lhe words ,1he
answer Lo llfe.." , ls dlsplayed on Lhe screen.


8. now LhaL Lhe app ls sLopped, you can examlne Lhe app's sLaLe and sLep Lhrough Lhe
app's execuLlon uslng Lhe followlng buLLons appearlng ln Lhe menu bar.



8uLLons from lefL Lo rlghL on Lhe navlgaLlon bar:
1 - 8esume
2 - Suspend
3 - 1ermlnaLe
4 - ulsconnecL debugger from emulaLor
3 - SLep lnLo
6 - SLep over
7 - SLep reLurn
8 - urop Lo frame
9 - use sLep fllLers

1 2 3 4 3 6 7 8 9




26
9. nexL, press Lhe 8esume lcon Lo conLlnue execuLlng Lhe app. 1he app wlll flnlsh
loadlng and wlll dlsplay Lhe LexL.



10. 1he nexL debugglng Lask wlll have you creaLe and dlsplay lnformaLlonal messages Lo
Lhe LogCaL panel, Lo help you beLLer undersLand Lhe appllcaLlon's runLlme behavlor.
1o generaLe Lhese messages, you wlll use meLhods ln Lhe androld.uLll.Log class. ?ou
wlll also need Lo lmporL Lhls class lnLo your appllcaLlon. Some LogCaL funcLlons
lnclude:

1 - Log.l(., .) - Sends an lnlC LogCaL message
2 - Log.d(., .) - Sends a uL8uC LogCaL message
3 - Log.e(., .) - Sends an L88C8 LogCaL message
4 - Log.v(., .) - Sends a vL88CSL LogCaL message

See hLLp://developer.androld.com/reference/androld/uLll/Log.hLml for more
lnformaLlon.





27
11. 8eLurn Lo Lhe !ava LdlLlng erspecLlve by cllcklng Lhe !ava lcon ln Lhe Lop-rlghL
corner.

12. lmporL Lhe androld.uLll.Log llbrary by Lyplng, lmporL androld.uLll.Log," near Lhe
beglnnlng of Lhe code for 1heAnswer.[ava. ?ou can also use Lhe Crganlze lmporLs
funcLlon (CLrl + ShlfL + 0 ls Lhe shorLcuL).





28
13. 1he Log class' meLhods requlre a sLrlng called a 1ag, whlch ldenLlfles Lhe creaLor of
Lhe message and can be used Lo sorL and fllLer Lhe messages when Lhey are
dlsplayed. CreaLe a consLanL called 1AC wlLhln Lhe 1heAnswer class , by Lyplng,
prlvaLe flnal SLrlng 1AC = 1heAnswer","

14. use Lhe Log.l() funcLlon Lo creaLe and ouLpuL a log message. !usL before Lhe llne LhaL
sLarLs, lnL val = ." Lype ln a new llne: Log.l(1AC, rlnLlng Lhe answer Lo llfe"),"








29
13. Save your changes.


16. 8un Lhe appllcaLlon.







30
17. Cnce Lhe app ls run, open Lhe LogCaL panel aL Lhe boLLom of Lhe !ava erspecLlve.
Look for Lhe search box , enLer, Lag:1heAnswer" and hlL 8eLurn. ?ou wlll now see
Lhe log message from Lhe 1heAnswer appllcaLlon ln Lhe LogCaL panel.





31
lat / - Lxoo| ng t|e l LL
>9? :@A<<*:6BC: - ln Lhls parL of Lhe lab you'll experlmenL wlLh dlfferenL emulaLed devlces
and Lake a screenshoL. lf necessary, reLurn Lo arL 3, followlng Lhe dlrecLlons unLll you reach
Lhls screen.


1. 1hls Llme around change Lhe uevlce from Lhe nexus S Lo any oLher devlce, for
example a LableL or Lhe nexus 4.





32
2. Cnce you've creaLed Lhe Avu, sLarL Lhe emulaLor.



3. Cnce your emulaLor has loaded, Lake a screenshoL of Lhe emulaLed devlce. navlgaLe
Lo Lhe uuMS erspecLlve of Lhe developmenL klL.







33
4. Cllck on Lhe Screen CapLure buLLon.


3. 1he snapshoL wlll appear ln a separaLe wlndow.






34


6. ress Save Lo save Lhe lmage Lo anywhere on your compuLer. ?ou have now creaLed
a screenshoL of your androld devlce.








33
7. >9D C<E*<C - lor Lhls nexL parL you'll use LelneL Lo change Lhe neLwork speed
conflguraLlon ln Lhe emulaLor. ?ou wlll need Lo use Wlndows' command prompL,
Mac CS x's 1ermlnal, or Lhe Llnux shell. (lcLures ln Lhese lnsLrucLlons wlll use
Wndows 7)

8. 8eLurn Lo Lhe Androld uuMS vlew ln Lcllpse Lo flnd Lhe porL Lhe androld emulaLor ls
runnlng on (lL's also ln Lhe LlLle bar of Lhe emulaLor).







36
9. 8eLurn Lo Lhe command llne lnLerface and enLer LelneL localhosL <your porL>". ln
my case l enLered LelneL localhosL 3334".


10. 1he console wlll dlsplay LexL lndlcaLlng LhaL you're connecLed Lo Lhe emulaLor.








37
11. 1o seL Lhe neLwork speed Lo LuCL, enLer neLwork speed edge". AfLerwards, you
wlll see Lhe response Ck".

12. 8eLurn Lo Lhe emulaLor and open up Lhe browser Lo hLLp://www.google.com" and
measure how long lL Lakes for Lhe page Lo fully load. 1he measuremenL doesn'L need
Lo be preclse. AfLer each Llme you load Lhe page, clear Lhe 8rowser's cache by golng
Lo Lhe 8rowser's menu buLLon and selecLlng SeLLlngs> rlvacy & SecurlLy > Clear
cache.

13. 8eLurn Lo Lhe command llne and Lhls Llme swlLch Lhe neLwork speed Lo full. uo Lhls
by enLerlng neLwork speed full"







38
14. 8eLurn Lo Lhe emulaLor and open up Lhe browser Lo hLLp://www.google.com" agaln
measurlng how long Lhe page Lakes Loo load, Lhls Llme on full neLwork speed.

13. 8epeaL sLeps 12-13 agaln four more Llmes. WhaL was Lhe average load Llme under
each neLwork speed? uoes Lhe emulaLor really seem Lo affecL neLwork speed?









39
16. >9F :+(.4(5 :G: G+33'5+3 - lor Lhls parL of Lhe asslgnmenL you'll be sendlng an
SMS message Lo your emulaLor Lhrough Lhe command llne. 8eLurn Lo Lhe command
llne and enLer: sms send <sender's phone number> <message>"


17. ln Lhe emulaLor, you wlll recelve a LexL message and see a noLlflcaLlon for a LexL
message, from Lhe phone number you enLered wlLh Lhe message you enLered.







40
18. >9H G$.4I4+. 6+88$ J$%8. - 8emember Lhe flrsL app you made? LeL's reLurn Lo LhaL!

19. ln Lhls parL you'll modlfy Lhe orlglnal Pello world!" message of your flrsL app. 1o do
Lhls you need Lo modlfy Lhe sLrlng value ln \res\value\sLrlng.xml


20. Change Lhe value of Lhe sLrlng Lo "Pello world! My name ls [yourname]."







41
21. now run Lhe app and see Lhe change!

22. now add supporL for anoLher language such as Spanlsh! 1o do Lhls, you'll need Lo
creaLe approprlaLe sLrlng flle, run your app, change Lhe emulaLor lnsLance's defaulL
language Lo Spanlsh, and Lhen run Lhe app. ?ou're Spanlsh sLrlng, could be: "Pola
Mundo! Me llamo [yourname]."

lor more lnformaLlon, Lake a look aL:
hLLp://developer.androld.com/Lralnlng/baslcs/supporLlng-devlces/languages.hLml





42

23. >9F 64+%'%0KLM4+7 C$$8 - use Lhe Plerarchyvlew Lool (or Lhe uump vlew Plerarchy
Lo ul AuLomaLor buLLon ln uuMS) Lo dlsplay and examlne Lhe user lnLerface of Lhe
defaulL CalculaLor App ln your Avu. 1o do Lhls, sLarL Lhe emulaLor and open Lhe
CalculaLor App.

24. ln Lcllpse, open Lhe uuMS vlew, Lhen selecL uump vlew Plerarchy Lo ul
AuLomaLor" buLLon, and selecL CalculaLor acLlvlLy. Cr use Lhe hlerarchyvlewer
program from Lhe command llne.





43

23. A dlalog box wlll appear as Lhe hlerarchy vlewer does lLs work.

26. Cnce lL's done, you'll see a screen such as Lhe one shown below. See lf you can use
Lhe Plerarchy vlewer Lo answer Lhe followlng quesLlons:

a. WhaL ls Lhe helghL of Lhe vlew Lree (how many levels deep ls Lhe hlerarchy)?
b. Lxamlne Lhe vlew showlng Lhe plus (+) buLLon. WhaL klnd of vlew ls lLs
parenL? Pow many chlldren vlews does lLs parenL conLaln? WhaL ls Lhe
relaLlve lndex (poslLlon) of Lhe plus (+) buLLon vlew wlLhln lLs parenL?




44
27. >9N O+3P@8$0P - uownload Lhe source code for ueskClock appllcaLlon. SLudy lL and
Lry Lo answer Lhe quesLlons below.
a. unzlp Lhe flle and Lhen lmporL Lhe pro[ecL lnLo Lcllpse. uon'L worry abouL any
compllaLlon or synLax errors LhaL mlghL appear.
b. Cpen Lhe pro[ecL's AndroldManlfesL.xml flle. 1he flle has Lags correspondlng
Lo all of Lhe four fundamenLal componenL classes. ldenLlfy one lnsLance of
each fundamenLal componenL. lor each one, ldenLlfy lLs correspondlng
source code flle and flnd Lhe llne of code LhaL deflnes Lhe class as a subLype
of one of Lhe fundamenLal componenLs (e.g., class x exLends AcLlvlLy, class ?
exLends Servlce, eLc.)
c. Look ln Lhe res dlrecLory for Lhls appllcaLlon. Pow many layouL dlrecLorles are
Lhere? Whlch speclflc devlce slzes and/or orlenLaLlons would use each of Lhe
dlfferenL layouL dlrecLorles you've found. lor help wlLh Lhls problem you
could read Lhe followlng blog posL:
hLLp://androld-developers.blogspoL.com/2011/07/new-Lools-for-managlng-
screen-slzes.hLml
d. Look agaln ln Lhe res dlrecLory. Pow many dlfferenL values dlrecLorles are
Lhere? llnd Lwo examples of resource sLrlngs LhaL can be conflgured for
dlfferenL languages.
e. Look aL 8.[ava flle LhaL was generaLed for Lhls appllcaLlon. 1here ls a fleld ln
Lhe ld class called clLles". ln whlch funcLlon and class does Lhls fleld geL
used? Pow ls lL referenced ln Lhe appllcaLlon code? PlnL: use Lcllpse's Cpen
Call Plerarchy feaLure.





43
28. >9> E$5@'& - uownload Lhe source code for WlklnoLes appllcaLlon and run Lhe
appllcaLlon. lor Lhls Lask, you'll be famlllarlzlng yourself furLher wlLh LogCaL.
a. uslng Lhe LogcaL feaLure of uuMS, fllLer ouL messages relaLlng Lo Lhe
WlklnoLes appllcaLlon.

b. WhaL ls Lhe log Lag used by Lhls appllcaLlon's maln AcLlvlLy? Where do you
see LhaL ln Lhe appllcaLlon's source code?
c. WhaL ls Lhe message assoclaLed wlLh Lhe flrsL Log enLry emlLLed when Lhls
appllcaLlon sLarLs runnlng? lor more lnformaLlon, read Lhe followlng
webpage:
hLLp://developer.androld.com/Lools/debugglng/debugglng-log.hLml





46
29. >9Q 6+'# M4+7 - use uuMS Lo vlew heap usage for Lhe WlklnoLes process. ln Lhe
uevlces Lab, selecL Lhe WlklnoLes process (com.google.androld.wlklnoLes). And cllck
Lhe updaLe Peap buLLon.


a. ln Lhe Peap Lab, cllck CauseCC Lo enable Lhe collecLlon of heap daLa.
b. Pow many ob[ecLs have been creaLed?
c. Whlch Lype of Cb[ecL has by allocaLed mosL frequenLly?
d. Pow much memory has been allocaLed for Lhls Lype of Cb[ecL?





47
30. >9R G+&K$. S%$I484(5 - use uuMS Lo vlew meLhod execuLlon sequences for Lhe
WlklnoLes process. ln Lhe uevlces Lab, selecL Lhe WlklnoLes process and Lhen cllck
Lhe SLarL MeLhod roflllng buLLon.

lnLeracL wlLh Lhe WlklnoLe appllcaLlon.






48

and Lhen cllck Lhe SLop MeLhod roflllng buLLon.

?our screen should look someLhlng llke Lhls:


a. Look aL Lhe proflle panel. llnd a meLhod LhaL ls parL of Lhe WlklnoLes
appllcaLlon (lL's ln Lhe com.google. androld.wlklnoLes package).
b. WhaL ls Lhe name of Lhe meLhod?
c. ln whaL flle ls Lhe source code for Lhls meLhod?
d. WhaL are Lhe excluslve real Llme and Lhe lncluslve real Llme spenL ln Lhls
meLhod? Why are Lhey dlfferenL?




49
31. >9R O+T;554(5 '(. U2(4& C+3&4(5 - uownload Lhe source code for Lhe slmple
calculaLor appllcaLlon wlLh correspondlng !unlL 1esL pro[ecL aL:
hLLp://code.google.com/p/slmple-calc-unlL-
LesLlng/downloads/deLall?name=lullCodeuownload.zlp&can=2&q=

32. lmporL Lhe Lwo pro[ecLs lnLo ecllpse and run Lhe SlmpleCalc1esL app ln Lhe emulaLor.

33. SeL a breakpolnL aL Lhe llne 91 (luncLlon LesLSubLracLvalues() of
MaLhvalldaLlon.[ava) and sLarL uebugglng Lhe pro[ecL.







30
34. Also Lry debugglng Lhe app wlLh Androld !unlL 1esLs. 8lghL-cllck > uebug As >
Androld !unlL 1esL.


33. SLep ln Lhe funcLlon, debug lL and use Lhe waLch wlndows Lo keep Lrack of Lhe value
of Lhe varlable maLh8esulL." 1hen please Lry Lo answer Lhe followlng quesLlons.

a. WhaL are Lhe values of maLh8esulL" before and afLer llne 94?
b. ls Lhe laLer value a correcL value?

Vous aimerez peut-être aussi