A Lap Around Android Part 1
-
Upload
ben-monro -
Category
Technology
-
view
1.060 -
download
0
description
Transcript of A Lap Around Android Part 1
![Page 1: A Lap Around Android Part 1](https://reader034.fdocuments.in/reader034/viewer/2022052619/555ae347d8b42a4c7d8b45d3/html5/thumbnails/1.jpg)
A Lap Around Android IBen Monro
June 26, 2010SoCalCodeCamp
![Page 2: A Lap Around Android Part 1](https://reader034.fdocuments.in/reader034/viewer/2022052619/555ae347d8b42a4c7d8b45d3/html5/thumbnails/2.jpg)
2
Overview
Platform Overview The Emulator & DDMS Hands on walk through
Activities UI Components Intents Resources Dialogs
Questions & Answers
![Page 3: A Lap Around Android Part 1](https://reader034.fdocuments.in/reader034/viewer/2022052619/555ae347d8b42a4c7d8b45d3/html5/thumbnails/3.jpg)
3
Android: The platform
![Page 4: A Lap Around Android Part 1](https://reader034.fdocuments.in/reader034/viewer/2022052619/555ae347d8b42a4c7d8b45d3/html5/thumbnails/4.jpg)
4
Applications in Android
Written in Java Bundled into APK packages that include:
Compiled Java code Data, files & other resources required for the application to
install & run Runs in its own isolated process & java VM. Have a manifest file that defines the way the OS Launches
& interacts with the Application. Components of an Android App:
Activities Services Broadcast Receivers Content Providers – Activated by Content Resolver Intents are Asynchronous system messages that tell the OS
when/how to do something.
Activated by “Intents”
![Page 5: A Lap Around Android Part 1](https://reader034.fdocuments.in/reader034/viewer/2022052619/555ae347d8b42a4c7d8b45d3/html5/thumbnails/5.jpg)
5
Activities
Activities are the core of Android App UIs. Made up of Views & View Groups (aka Layouts)
Examples of Views:▪ TextView / EditText▪ ListView / GridView▪ Gallery▪ Spinner▪ Button▪ ImageView▪ DatePicker
Layouts:▪ LinearLayout▪ RelativeLayout▪ TableLayout▪ AbsoluteLayout▪ Frame Layout▪ TabHost*
Can launch other Activities, Services & Broadcast Events
Built using XML, code or Both Supports Styles, Themes, Localization etc.
![Page 6: A Lap Around Android Part 1](https://reader034.fdocuments.in/reader034/viewer/2022052619/555ae347d8b42a4c7d8b45d3/html5/thumbnails/6.jpg)
6
Android Services
Services are processes that run in the background.
Not much unlike a windows service. Can be used to play music, communicate
with a server, perform long running processes etc.
Typically used to trigger notifications in the status bar.
Communication (IPC) can be done using AIDL – Android Interface Definition Language.
![Page 7: A Lap Around Android Part 1](https://reader034.fdocuments.in/reader034/viewer/2022052619/555ae347d8b42a4c7d8b45d3/html5/thumbnails/7.jpg)
7
Broadcast Receivers
Receive and react to broadcast announcements from the OS
No UI, but they may trigger an Activity
Examples: Time-zone has changed Battery is low Picture has been taken User has changed a system
preference
![Page 8: A Lap Around Android Part 1](https://reader034.fdocuments.in/reader034/viewer/2022052619/555ae347d8b42a4c7d8b45d3/html5/thumbnails/8.jpg)
8
Content Providers
Provide clean way for your application to expose its data to other applications on the device and visa versa.
Data can be stored in any way you want, Files, Preferences, SQL Lite DB or whatever other resource you need.
Content can be audio, video, images, contact information, etc.
![Page 9: A Lap Around Android Part 1](https://reader034.fdocuments.in/reader034/viewer/2022052619/555ae347d8b42a4c7d8b45d3/html5/thumbnails/9.jpg)
9
Home Screen Widgets
A small “slice” of an application that runs on the application home screen.
Limited functionality & set of Views/Layouts can be used.
Good for displaying things like stock tickers, status updates, weather forecasts, news headlines, etc.
Allows users to see a key piece of your app, without having to leave their home screen.
![Page 10: A Lap Around Android Part 1](https://reader034.fdocuments.in/reader034/viewer/2022052619/555ae347d8b42a4c7d8b45d3/html5/thumbnails/10.jpg)
10
Killer Development Environment
What you’ll need to create Android Apps: Java Development Kit (JDK) 6 Eclipse▪ Spring Tool Suite with Google (
http://www.springsource.com/products/springsource-google-download
)▪ Eclipse Classic 3.5 or greater will also work
Android SDK Android Development Tools (ADT) – eclipse
plug-in for Android development.
![Page 11: A Lap Around Android Part 1](https://reader034.fdocuments.in/reader034/viewer/2022052619/555ae347d8b42a4c7d8b45d3/html5/thumbnails/11.jpg)
11
Creating an Android Project in Eclipse File New Android Project
![Page 12: A Lap Around Android Part 1](https://reader034.fdocuments.in/reader034/viewer/2022052619/555ae347d8b42a4c7d8b45d3/html5/thumbnails/12.jpg)
12
Project Structure
• Source Code Directory• UI Layout Directory (XML) – validated by compiler w/ detailed error
messages• Application Manifest – tells OS how to interact w/ your app.• Icons / Graphics – can be bitmap or xml based• Strings / Styles / Themes
![Page 13: A Lap Around Android Part 1](https://reader034.fdocuments.in/reader034/viewer/2022052619/555ae347d8b42a4c7d8b45d3/html5/thumbnails/13.jpg)
13
The Flow of an Activity
![Page 14: A Lap Around Android Part 1](https://reader034.fdocuments.in/reader034/viewer/2022052619/555ae347d8b42a4c7d8b45d3/html5/thumbnails/14.jpg)
14
Demo time
Lets build a calculator!
![Page 15: A Lap Around Android Part 1](https://reader034.fdocuments.in/reader034/viewer/2022052619/555ae347d8b42a4c7d8b45d3/html5/thumbnails/15.jpg)
15
Resources
Main Android Dev Site: http://developer.android.com
Stack overflow: http://stackoverflow.com/questions/tagged/android
Google I/O Talks: http://www.youtube.com/googledevelopers
Tutorials & Forums: http://www.anddev.org/ http://www.androidpeople.com/ http://www.androidcentral.com/
Building Android Apps with Hudson & Ant: http://www.facebook.com/note.php?note_id=499519
075367