8ulld ?
our llrsL Androld App
MSc 8lcardo larrera
Moblle Appllcauons
Cb[ecuve
Learn baslc concepLs of Androld developmenL:
Pow Lo creaLe an Androld pro[ecL and run a
debuggable verslon of Lhe app.
8aslc Androld app deslgn, lncludlng how Lo bulld a
slmple user lnLerface and handle user lnpuL.
uevelopmenL LnvlronmenL
1o develop Androld apps, you need:
Au1 8undle
Cr
uownload Lhe Androld Suk.
lnsLall Lhe Au1 plugln 22.6.2 or hlgher for Lcllpse (lf
you'll use Lhe Lcllpse luL).
uownload Lhe laLesL Suk Lools and plauorms uslng Lhe
Suk Manager.
Creaung an Androld ro[ecL
1. Cllck !"# ln Lhe Loolbar%
2. ln Lhe wlndow LhaL appears, open Lhe
&'()*+( folder, selecL &'()*+( &,,-+./0*'
1)*2".3, and cllck !"43%
Creaung an Androld ro[ecL
3. llll ln Lhe form LhaL appears:
Appllcauon name
ro[ecL name
ackage name
Mlnlmum 8equlred Suk
1argeL Suk
Complle WlLh
1heme
4. Cllck !"43
Creaung an Androld ro[ecL
3. Cn Lhe nexL screen Lo congure Lhe pro[ecL,
leave Lhe defaulL selecuons and cllck !"43%
6. 1he nexL screen can help you creaLe a
launcher lcon for your app. Cllck !"43%
Creaung an Androld ro[ecL
7. now you can selecL an acuvlLy LemplaLe from
whlch Lo begln bulldlng your app.
lor Lhls pro[ecL, selecL 5-/'6&.07+38 and cllck
!"43%
8. Leave all Lhe deLalls for Lhe acuvlLy ln Lhelr
defaulL sLaLe and cllck 9+'+:;%
Creaung an Androld ro[ecL
Creaung an Androld ro[ecL
?our Androld pro[ecL ls now a baslc "Pello
World" app LhaL conLalns some defaulL les.
1ake a few momenLs Lo famlllarlze yourself
wlLh Lhe Lcllpse workspace.
CeL lamlllar wlLh Au1
8evlew Lhe Source Code
[Link]
1he manlfesL le descrlbes Lhe fundamenLal
characLerlsucs of Lhe app and denes each of lLs
componenLs.
1he <uses-sdk> elemenL declares your app's
compaublllLy wlLh dlerenL Androld verslons uslng Lhe
androld:mlnSdkverslon and androld:LargeLSdkverslon
aurlbuLes.
<manifest xmlns:android="[Link] ... >
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="19" />
...
</manifest>
8evlew Lhe Source Code
src/
ulrecLory for your app's maln source les.
8y defaulL, lL lncludes an Activity class LhaL runs
when your app ls launched uslng Lhe app lcon.
res/
ConLalns several sub-dlrecLorles for app resources.
8evlew Lhe Source Code
drawable-hdpl/
ulrecLory for drawable ob[ecLs (such as blLmaps) LhaL
are deslgned for hlgh-denslLy (hdpl) screens.
layouL/
ulrecLory for les LhaL dene your app's user
lnLerface.
values/
ulrecLory for oLher varlous xML les LhaL conLaln a
collecuon of resources, such as sLrlng and color
denluons.
8evlew Lhe Source Code
When you bulld and run Lhe defaulL Androld
app, Lhe defaulL Activity class sLarLs and
loads a layouL le LhaL says "Pello World."
1o run your app on Lhe emulaLor you need Lo
rsL creaLe an Androld vlrLual uevlce (Avu)
CreaLe an Avu
1o creaLe an Avu:
1. Launch Lhe Androld vlrLual uevlce Manager:
ln Lcllpse, cllck Androld vlrLual uevlce Manager from
Lhe Loolbar.
2. ln Lhe !"#$%&# (&$)*+, -./&0. 1+"+2.$ panel,
cllck !"#!
CreaLe an Avu
3. llll ln Lhe deLalls for Lhe Avu.
Clve lL a name, a plauorm LargeL, an Su card slze, and
a skln (PvCA ls defaulL).
4. Cllck <)"/3" &=>%
3. SelecL Lhe new Avu from Lhe !"#$%&# (&$)*+,
-./&0. 1+"+2.$ and cllck ?3/)3.
6. Aer Lhe emulaLor booLs up, unlock Lhe
emulaLor screen.
CreaLe an Avu
8unnlng ?our App
1. Cllck @A' from Lhe Loolbar.
2. SelecL &'()*+( &,,-+./0*' and cllck BC%
Lcllpse lnsLalls Lhe app on your Avu and sLarLs
lL on Lhe LmulaLor..
8unnlng ?our App
Aer you nlsh, you
should have an app LhaL
looks llke Lhls: