Programming in Java Android encourages high-level development Android uses Java as main programming language Android uses Java as main programming language Inherits basic classes
Trang 1Mobile image processing – Part 1
Mobile application development on Android
“Hello World” project
Hello World project
“Viewfinder EE368” project
Image processing library g g y
Mobile application examples
Trang 2Layar augmented reality
Landmark Recognition
http://www layar com http://www.layar.com
Trang 3Streaming mobile augmented reality
Book cover recognition
http://www youtube com/watch?v=fKm7iknUFqc http://www.youtube.com/watch?v=fKm7iknUFqc
Trang 5Industry support for Android
Open source mobile platform developed by Google
Supported by Open Handset Alliance: over 60 companies
Supported by Open Handset Alliance: over 60 companies including major service carriers and major mobile device manufacturers
Trang 6Programming in Java
Android encourages high-level development
Android uses Java as main programming language
Android uses Java as main programming language
Inherits basic classes from conventional Java
String, Container, Math, IO, Network
Adds new classes specific to mobile devices
Camera, Telephony, Map, GPS, Speech
Trang 7Android software stack
[ Professional
[ Professional Android
Application Development ]
Trang 8Android software stack
[ Professional
[ Professional Android
Application Development ]
Trang 9Android software stack
[ Professional
[ Professional Android
Application Development ]
Trang 10Android software stack
[ Professional
[ Professional Android
Application Development ]
Trang 11Android programming framework
program installation
and execution
system messages
Eclipse IDE
programmer inputs IDE
inputs
Android SDK
Java Runtime
Trang 12Class tutorial for Android
Framework can be installed from scratch on your own
computer (Windows, Mac, or Linux) following the tutorial p ( , , ) g provided to the class
Tutorial explains how to download the different software packages
Tutorial explains how to install and link packages
Tutorial explains how to install and link packages
Tutorial provides full source for code examples used in lecture
Link: http://ee368.stanford.edu/Android
Trang 13Class tutorial for Android
Trang 14Class tutorial for Android
Trang 15Class tutorial for Android
Framework can be installed from scratch on your own
computer (Windows, Mac, or Linux) following the tutorial p ( , , ) g provided to the class
Tutorial explains how to download the different software packages
Tutorial explains how to install and link packages
Tutorial explains how to install and link packages
Tutorial provides full source for code examples used in lecture
Link: http://ee368.stanford.edu/Android
Framework for Linux already installed and tested on the
SCIEN computers
Add a soft link in your Leland account to our software
Personalize your Eclipse workspace
Li k htt // 368 t f d d /A d id
Link: http://ee368.stanford.edu/Android
Trang 16Eclipse IDE Different
perspectives
Text editor
Class hierarchy
Project files j
Errors and warnings
Trang 17Eclipse IDE: project files
Java source files
Program new functions here
Auto-generated Java files
Don’t edit anything here
Trang 18Eclipse IDE: Android phone emulator
Dummy checkerboard pattern
mimics real camera viewfinder
Trang 19“Hello World” project
Goals of this project
Learn how to create a new Android project p j
Learn how to edit Java source files
Learn how to create layouts in XML
Learn how to run a new program on emulator and phone
Learn how to run a new program on emulator and phone
Trang 20Creating a new project (1)
Trang 21Creating a new project (2)
Trang 22Creating a new project (3)
Make sure this is your personal workspace
Trang 23Creating a new project (4)
Trang 24Editing the Java source file
Every visible program uses an extension of the Activity class
To auto-import necessary
classes, use Control + Shift + O
extension of the Activity class
Set the layout of this Activity by overriding the onCreate method
Trang 25Editing the layout resource file
Trang 26Editing the values resource file
Define string constants, number g , constants, color constants, etc here
Trang 28Debugging syntax errors
Look for red markers on the side and explanations below
Trang 29Running the program (1)
Trang 30Running the program (2)
03EH368929E3K
Actual device
Emulator
Trang 31Program execution messages on the console
Program apk file installed to device
Main Activity started on device