lab+1+moi+truong+lap+trinh+android
TRANSCRIPT
-
8/11/2019 Lab+1+Moi+truong+lap+trinh+android
1/5
Lab 1Lm quen vi mi trng lp trnh Android
I. M! ti"u Thit lp mi trng lp trnh android To project hello world Tm hiu mt s th!nh ph"n trong android project To #$ %&n gi'n
II. #$i dung
1. %hi&t lp mi trng lp trnh android(i trng lp trnh cho android c"n ph'i c) c*c th!nh ph"n sau+
,clipse - ./T plugin .ndroid 0/1 Tools .ndroid 2lat3orm4tools
5!o tranghttp+66de7eloper8android8com6sd96inde:8htmldownload ; ./T
-
8/11/2019 Lab+1+Moi+truong+lap+trinh+android
2/5
Ja7igation Jame+ Jone4 Flic9 ;utton Iinish
5. 67! thnh ph8n !9 b:n trong m$t pro2e!t4 F^ng ging nh ja7a application 9hi tao trong ,clipse8 1hi tao android application trong ./T ta c^ngc) c*c th!nh ph"n c& ;'n nh hnh d_i
Th mEc ;r! ch`a codeja7a+
4e;t.?mlch`a tGt c' c*c thng tin7 c"n thit cho 7iHc chA`ng dEng+
4 TCn `ng dEng4 /anh s*ch c*c
.cti7ities 0er7ices
-
8/11/2019 Lab+1+Moi+truong+lap+trinh+android
3/5
4 ight clic9 7!o project chKn un a; un !on>iguration;FH Trong ta; Target chKn .lwaAs prompt to pic9 de7ice4 Flic9 applA4 Flic9 run
. %)o giao diCn ngi dJng K9n gi:n
.ndroid s dEng 3ile :ml % to giao diHn8 /o %) % tao #$ cho `ng dEng ta ph'i to 3ile :ml4 FhKn ile #e+ Android ML ile4 Ju .ndroid (\ Iile 9hng :uGt hiHn ta chKn ile #e+ ther4 FhKn Android Android ML ile4 Flic9 7!o ;utton Je:t4 Jhp tCn 3ile 7!o name]getter8:ml8 \u + 3ile :ml n!A ph'i nqm trong 3old 6res6laAout4 FhKn \inear\aAout4 Flic9 ;utton Iinish
4 /ou;leclic9 7!o3ile
name]getter8:ml4 Th'A %i thuc tnh cBa android+laAout]width 7! android+laAout]height th!nh 3ill]parent4 FhKn ta; =raphical \aAout4 1>o th' c*c %i tbng+ Te:t5iew ,ditTe:t O2lain Te:tR 7!
-
8/11/2019 Lab+1+Moi+truong+lap+trinh+android
4/5
4 FhKn 0tring element 7! nhp c*c thng s+ Jame+ name]prompt 5alue+ [hat is Aour name
4 ua li 3ile nameNgetter.?mlTa thit lp c*c tham s Te:t5iew +android+te:tSvstring6name]prompt
,ditTe:t+ android+hintS,nter Aour name
-
8/11/2019 Lab+1+Moi+truong+lap+trinh+android
5/5
-Thm cc dng code trong hm onCreatethis.nameField= (EditText!nd"ie#$%&d('.id.nameField;$tton o)$tton = ($tton!nd"ie#$%&d('.id.o)$tton;o)$tton.set*nClic)+istener(this;
- ,in thc phong th/c onClic)0*verridep1licvoidonClic)("ie# v 2
Toast.ma)eText(Enter3ame4ctivit%.this5 6,ello 67 nameField.getText(5Toast.+E38T,9+*38.sho#(;
:
- 'n /ng dng