android app anatomy - york university€¦ · android app anatomy eecs 4443 – mobile user...

13
12/01/2016 1 Android App Anatomy EECS 4443 – Mobile User Interfaces Scott MacKenzie York University © Scott MacKenzie Android UI Status Bar Action Bar Content Area Navigation Bar 2 © Scott MacKenzie (click here)

Upload: others

Post on 08-Jun-2020

35 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Android App Anatomy - York University€¦ · Android App Anatomy EECS 4443 – Mobile User Interfaces Scott MacKenzie York University ©ScottMacKenzie Android UI Status Bar Action

12/01/2016

1

Android App Anatomy

EECS 4443 – Mobile User Interfaces

Scott MacKenzie

York University

© Scott MacKenzie

Android UI

Status Bar

Action Bar

Content Area

Navigation Bar

2© Scott MacKenzie

(click here)

Page 2: Android App Anatomy - York University€¦ · Android App Anatomy EECS 4443 – Mobile User Interfaces Scott MacKenzie York University ©ScottMacKenzie Android UI Status Bar Action

12/01/2016

2

Android Application – In Parts

From Studio's“Android” viewof the project…

• Project

• Module

• Manifest

• Package

• Source files

• Images (for app)

• XML layout 

• String constants

• Build script

3© Scott MacKenzie

Source (.java) Files

4© Scott MacKenzie

Page 3: Android App Anatomy - York University€¦ · Android App Anatomy EECS 4443 – Mobile User Interfaces Scott MacKenzie York University ©ScottMacKenzie Android UI Status Bar Action

12/01/2016

3

Android Application – In Parts

From Studio's“Android” viewof the project…

• Project

• Module

• Manifest

• Package

• Source files

• Images (for app)

• XML layout 

• String constants

• Build script

5© Scott MacKenzie

Layout (.xml) Files

6© Scott MacKenzie

Page 4: Android App Anatomy - York University€¦ · Android App Anatomy EECS 4443 – Mobile User Interfaces Scott MacKenzie York University ©ScottMacKenzie Android UI Status Bar Action

12/01/2016

4

Layout (.xml) Files

7© Scott MacKenzie

Android Application – In Parts

From Studio's“Android” viewof the project…

• Project

• Module

• Manifest

• Package

• Source files

• Images (for app)

• XML layout 

• String constants

• Build script

8© Scott MacKenzie

Page 5: Android App Anatomy - York University€¦ · Android App Anatomy EECS 4443 – Mobile User Interfaces Scott MacKenzie York University ©ScottMacKenzie Android UI Status Bar Action

12/01/2016

5

String (.xml) Constants

9© Scott MacKenzie

Android Application – In Parts

From Studio's“Android” viewof the project…

• Project

• Module

• Manifest

• Package

• Source files

• Images (for app)

• XML layout 

• String constants

• Build script

10© Scott MacKenzie

Page 6: Android App Anatomy - York University€¦ · Android App Anatomy EECS 4443 – Mobile User Interfaces Scott MacKenzie York University ©ScottMacKenzie Android UI Status Bar Action

12/01/2016

6

What the heck is "manifest"?

• This is a reasonable question if you are new to Android programming

• Here's a simple way to answer this question (and other questions like this)

• Go to

and type "manifest" in the search field (      )

© Scott MacKenzie11

developer.android.com

Manifest (.xml) File

12© Scott MacKenzie

No! (next slide)

Page 7: Android App Anatomy - York University€¦ · Android App Anatomy EECS 4443 – Mobile User Interfaces Scott MacKenzie York University ©ScottMacKenzie Android UI Status Bar Action

12/01/2016

7

minSDK, targetSDK

• Android projects are built to run on devices supporting a range of API levels

• API level determined in the project setup

• Varies by IDE

• Eclipse:– Specified in AndroidManifest.xml via <uses-

sdk> element (previous slide)

• Studio:– Specified in build.gradle (next slide)

© Scott MacKenzie13

Android Application – In Parts

From Studio's“Android” viewof the project…

• Project

• Module

• Manifest

• Package

• Source files

• Images (for app)

• XML layout 

• String constants

• Build script

14© Scott MacKenzie

Page 8: Android App Anatomy - York University€¦ · Android App Anatomy EECS 4443 – Mobile User Interfaces Scott MacKenzie York University ©ScottMacKenzie Android UI Status Bar Action

12/01/2016

8

build.gradle (Demo_Android)

© Scott MacKenzie15

API Levels (partial list)

© Scott MacKenzie16

http://developer.android.com/guide/topics/manifest/uses-sdk-element.html

Page 9: Android App Anatomy - York University€¦ · Android App Anatomy EECS 4443 – Mobile User Interfaces Scott MacKenzie York University ©ScottMacKenzie Android UI Status Bar Action

12/01/2016

9

Changing minSDK & targetSDK

• How do  you change the min/target API levels for an Android project using Studio?

1. Edit build.gradle

2. Sync Project with Gradle Files (      )

• Or (preferred) …1. Right click on your project file ("app")

2. Select "Open Module Settings"

3. Go to the "Flavors" tab and edit settings

1. A better question…  How do you figure out stuff like this?  (next slide)

© Scott MacKenzie17

StackOverflow to the Rescue

© Scott MacKenzie18

http://stackoverflow.com/questions/19465049/changing-api-level-android-studio

Page 10: Android App Anatomy - York University€¦ · Android App Anatomy EECS 4443 – Mobile User Interfaces Scott MacKenzie York University ©ScottMacKenzie Android UI Status Bar Action

12/01/2016

10

Android Package (.apk file)

19© Scott MacKenzie

From Studio's“Project” viewof the project…

Activities

20© Scott MacKenzie

Page 11: Android App Anatomy - York University€¦ · Android App Anatomy EECS 4443 – Mobile User Interfaces Scott MacKenzie York University ©ScottMacKenzie Android UI Status Bar Action

12/01/2016

11

Minimum Implementation

21© Scott MacKenzie

Activity Lifecycle

“Running”

22© Scott MacKenzie

Page 12: Android App Anatomy - York University€¦ · Android App Anatomy EECS 4443 – Mobile User Interfaces Scott MacKenzie York University ©ScottMacKenzie Android UI Status Bar Action

12/01/2016

12

ActivityLifecycle(more detail)

23© Scott MacKenzie

Activity Lifecycle Callbacks (1)

24© Scott MacKenzie

Page 13: Android App Anatomy - York University€¦ · Android App Anatomy EECS 4443 – Mobile User Interfaces Scott MacKenzie York University ©ScottMacKenzie Android UI Status Bar Action

12/01/2016

13

Activity Lifecycle Callbacks (2)

25© Scott MacKenzie