Chapter3 Android Project
Chapter3 Android Project
Android Project
Course Outline Chapter 3
• Android Project
• Starting a project
• Setting up emulator
• Creating Launch Configurations
• Running the Android App
• Understanding project structure
Setting up your Project
Pros:
Conveniently test app on basic hardware by clicking in software
Easy to test app on various devices (phones, tablets, TVs, etc), various screen
sizes
Cons:
Some hardware missing, especially hardware for sensing environment
E.g. GPS, camera, video recording, etc
Emulator Limitations
Activities
independent of each other
E.g. Activity 1 can write data, read by activity 2
App Activities derived from Android’s Activity class
Our First Android App
3 Files in “Hello World” Android Project
Activity_my.xml: XML file specifying screen layout
AndroidManifest.xml:
Lists all screens, components of app
Start in AndroidManifest.xml
Read list of activities
(screens) Start execution
from Activity tagged Launcher
Create/execute activities
(declared in java files)
E.g. MainActivity.Java
Your
package
name
Android
version
List of
activities
(screens) One activity (screen)
in your app designated LAUNCHER.
The app starts running here
Execution Order
Start in AndroidManifest.xml
Read list of activities
(screens) Start execution
from Activity tagged Launcher
Create/execute activities
Next (declared in java files)
E.g. MainActivity.Java
Package declaration
Initialize by calling
onCreate( ) method
of base Activity class
Note: Android calls your Activity’s onCreate Use screen layout (design)
method once it is created declared in file main.xml
Execution Order
Start in AndroidManifest.xml
Read list of activities
(screens) Start execution
from Activity tagged Launcher
Create/execute activities
(declared in java files)
E.g. MainActivity.Java
Declare Layout
Add widgets
Widget properties
(e.g. center contents
horizontally and
Android Files
Android
Project
File
Structur
e
3 Main Files to
Write Android app
Files in an Android Project
res/ (resources) folder contains static resources
you can embed in Android screen (e.g. pictures,
string declarations, etc)
Can use the same HTML tags to add style (italics, bold, etc) to
Android strings
References