24
9/21/10 1

Android Tutorial Handout

Embed Size (px)

Citation preview

Page 1: Android Tutorial Handout

9/21/10

1

Page 2: Android Tutorial Handout

9/21/10

2

Page 3: Android Tutorial Handout

9/21/10

3

Example  taken  from  Dan  Borenstein’s  2008  GoogleIO  presentation:  http://sites.google.com/site/io/dalvik-­‐vm-­‐internals  

Page 4: Android Tutorial Handout

9/21/10

4

Page 5: Android Tutorial Handout

9/21/10

5

Page 6: Android Tutorial Handout

9/21/10

6

User  presses  button  in  one  app,  and  it  causes  an  activity  defined  by  another  app  to  run!    

The  invoking  app  is  put  on  the  “stack”  and  when  the  user  hits  the  “back”  button,  it  is  restored.    

Activity  #1  

Activity  X  

Activity  Y  

Activity  Z  

Step  1:  An  activity  signals  an  intent.   Step  2:  Android  determines  

which  available  activity  is  most  appropriate  for  handling  that  intent.  

Page 7: Android Tutorial Handout

9/21/10

7

JDK v6 Eclipse 3.5

Android SDK ADT Plugin

Required Components

Optional Components

Page 8: Android Tutorial Handout

9/21/10

8

See http://developer.android.com/sdk/index.html for details.

See http://developer.android.com/sdk/index.html for details.

a) Download the appropriate package for your computer.

b) Unpack archive contents on your hard disk.

c) Adjust your system’s PATH variable (details on next slide)

Details vary by platform:

See http://developer.android.com/sdk/index.html for details.

Page 9: Android Tutorial Handout

9/21/10

9

See http://developer.android.com/sdk/index.html for details.

See http://developer.android.com/sdk/index.html for details.

See http://developer.android.com/sdk/index.html for details.

Page 10: Android Tutorial Handout

9/21/10

10

DEMO

Page 11: Android Tutorial Handout

9/21/10

11

ViewGroup uses the Composite design pattern to enable grouping of multiple View objects into non-trivial user interfaces.

In order to render a “view tree” on the device’s screen an Activity must call the setContentView() method.

Page 12: Android Tutorial Handout

9/21/10

12

The normal way to create user interfaces in Android apps is to declaratively describe the UI in an XML layout file, though UI’s can also be created programmatically in code.

Page 13: Android Tutorial Handout

9/21/10

13

Page 14: Android Tutorial Handout

9/21/10

14

DEMO

Page 15: Android Tutorial Handout

9/21/10

15

Page 16: Android Tutorial Handout

9/21/10

16

DEMO

Page 17: Android Tutorial Handout

9/21/10

17

Page 18: Android Tutorial Handout

9/21/10

18

Page 19: Android Tutorial Handout

9/21/10

19

Page 20: Android Tutorial Handout

9/21/10

20

DEMO

Page 21: Android Tutorial Handout

9/21/10

21

IntroActivity.java 117-135 (commit c27e6)

Page 22: Android Tutorial Handout

9/21/10

22

[commit fa7e] [commit c27e]

Page 23: Android Tutorial Handout

9/21/10

23

DEMO

Page 24: Android Tutorial Handout

9/21/10

24