Mais conteúdo relacionado Semelhante a Getting Started with Android Programming (20) Getting Started with Android Programming2. Module Objectives
After completing this module, you should be able to:
• List the Android architecture components
• List developer environment components
• Talk about the steps to develop and run an Android
program
1-2 Copyright © 2012, Stacy David Thurston. All rights reserved.
3. Architecture
1-3 Copyright © 2012, Stacy David Thurston. All rights reserved.
4. Android
Android is a software stack for mobile devices, phones, tablets:
• Operating system
• Middleware to run applications
• Key applications
Android link: What is Android?
1-4 Copyright © 2012, Stacy David Thurston. All rights reserved.
6. Development Environment Components
• Android SDK Manager
– To manager the download and install of SDK components
and tools
• Android SDK platform versions
– This course uses platform version 2.3.3
• Android Virtual Device (AVD) Manager
– Set emulator configurations to model actual devices
• Android Virtual Device emulator
• Eclipse IDE
– Android Development Tools (ADT) plugin for Eclipse
Android developer links: download, install, ...
1-6 Copyright © 2012, Stacy David Thurston. All rights reserved.
7. Questions
• What are the main Android Architecture components?
• What software does a developer need to develop Android
applications?
1-7 Copyright © 2012, Stacy David Thurston. All rights reserved.
9. Application Development Steps
After the environment is setup, create and run a Hello World
application:
• Start Eclipse.
• Create a New Project of type: Android Project:
– Project name: HelloWorld1
– Select the Build Target, example: Android 2.3.3
– Set:
—
Package Name: com.tigerfarm.HelloWorld1
—
Create Activity: HelloWorld1Activity
• Ready to code.
1-9 Copyright © 2012, Stacy David Thurston. All rights reserved.
10. Application Components
In the Eclipse project:
• Under resources values: string.xml
– Example, app_name is the application name that shows up
on the Android desktop.
– Set app_name to Hello World.
• Under resources layout: main.xml
– The form window layout and components.
• Under source: HelloWorld2Activity.java
– The application program code.
1 - 10 Copyright © 2012, Stacy David Thurston. All rights reserved.
11. Run Hello World
In Eclipse, click the Run button.
• Run as an Android
Application.
• The emulator starts.
• The application is loaded in
the emulator environment.
• Once the emulator is started,
it displays the time of day.
• Click the menu button, and
Hello World runs.
Android links: Hello World Tutorial
1 - 11 Copyright © 2012, Stacy David Thurston. All rights reserved.
12. Sample Form: Hello Dave
This application has:
• Under resources values: string.xml
– It is a best practice to always have string values
entered here.
• Under resources menu: amenu.xml
– Menu items.
– Note, the items have string ids verses hard code
string values.
• Under resources layout: main.xml
– Form definitions: buttons
• Under source: HelloDaveActivity.java
– The application program code.
1 - 12 Copyright © 2012, Stacy David Thurston. All rights reserved.
13. Running on an Actual Device
1 - 13 Copyright © 2012, Stacy David Thurston. All rights reserved.