A Lap Around Android Part 2
-
Upload
ben-monro -
Category
Technology
-
view
519 -
download
5
description
Transcript of A Lap Around Android Part 2
![Page 1: A Lap Around Android Part 2](https://reader034.fdocuments.us/reader034/viewer/2022052619/55583d77d8b42ac6078b4ce8/html5/thumbnails/1.jpg)
A Lap Around Android IIBen Monro
June 26, 2010SoCalCodeCamp
![Page 2: A Lap Around Android Part 2](https://reader034.fdocuments.us/reader034/viewer/2022052619/55583d77d8b42ac6078b4ce8/html5/thumbnails/2.jpg)
2
Overview
Diving Deep Preference Screens Relative vs. Linear Layouts XML Drawables ListView I/O Intents▪ Picking an image from the gallery▪ Using the built-in camera app.
Activities with Results SQLite3
![Page 3: A Lap Around Android Part 2](https://reader034.fdocuments.us/reader034/viewer/2022052619/55583d77d8b42ac6078b4ce8/html5/thumbnails/3.jpg)
Preference Screens
Unified XML Based Simple Customizable
![Page 4: A Lap Around Android Part 2](https://reader034.fdocuments.us/reader034/viewer/2022052619/55583d77d8b42ac6078b4ce8/html5/thumbnails/4.jpg)
Relative vs. Linear Layouts Relative Layouts
Objects laid out relative to root & each other.
Typically leads to less XML
More efficient with findViewById()
Linear Layouts Objects laid out one
after the other Can only be
horizontal or vertial Good for very
simple layouts. Get VERY hairy as
layouts get more complex.
4
![Page 5: A Lap Around Android Part 2](https://reader034.fdocuments.us/reader034/viewer/2022052619/55583d77d8b42ac6078b4ce8/html5/thumbnails/5.jpg)
5
XML Drawables
Shapes: Rectangle Oval Line Ring
Fills Solid, Gradient
Strokes & Corners Padding (applies to Views) Support for Layers
5
![Page 6: A Lap Around Android Part 2](https://reader034.fdocuments.us/reader034/viewer/2022052619/55583d77d8b42ac6078b4ce8/html5/thumbnails/6.jpg)
6
The (dreaded) ListView
Custom ListViews are much more complex
Use CustomListAdapter to render custom layouts
ViewInflater ViewHolder “pattern” Once you get over the
learning curve, its pretty cool.
![Page 7: A Lap Around Android Part 2](https://reader034.fdocuments.us/reader034/viewer/2022052619/55583d77d8b42ac6078b4ce8/html5/thumbnails/7.jpg)
7
I/O via Context
Standard Java I/O File InputStream OutputStream
Context.openInputStream() Context.openOutputStream
() Context.getFilesDir()
Access to your apps files. /data/data/com.myapp/files
![Page 8: A Lap Around Android Part 2](https://reader034.fdocuments.us/reader034/viewer/2022052619/55583d77d8b42ac6078b4ce8/html5/thumbnails/8.jpg)
8
Intents
Describes a way of doing some common task on the OS. Take/Pick a picture Share something Start an activity or service Pass parameters via ‘Extras’
![Page 9: A Lap Around Android Part 2](https://reader034.fdocuments.us/reader034/viewer/2022052619/55583d77d8b42ac6078b4ce8/html5/thumbnails/9.jpg)
9
Activities with Results
Request Code is passed into the intent.
Result Code for OK, Cancel
Intent containing any extra result data.
![Page 10: A Lap Around Android Part 2](https://reader034.fdocuments.us/reader034/viewer/2022052619/55583d77d8b42ac6078b4ce8/html5/thumbnails/10.jpg)
10
SQLite3
Built into Android Lightweight Simple SQLite Browser
Build & prepare your DB prior to deployment. No need to code all the setup http://sourceforge.net/projects/sqlitebrowser/
DB4O Simple OO based DB. No SQL code http://www.db4o.com/
10
![Page 11: A Lap Around Android Part 2](https://reader034.fdocuments.us/reader034/viewer/2022052619/55583d77d8b42ac6078b4ce8/html5/thumbnails/11.jpg)
11
Demo Time
PicNotes – simple proof of concept to show off all this stuff.
![Page 12: A Lap Around Android Part 2](https://reader034.fdocuments.us/reader034/viewer/2022052619/55583d77d8b42ac6078b4ce8/html5/thumbnails/12.jpg)
12
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