A Lap Around Android II Ben Monro June 26, 2010 SoCalCodeCamp
May 17, 2015
A Lap Around Android IIBen Monro
June 26, 2010SoCalCodeCamp
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
Preference Screens
Unified XML Based Simple Customizable
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
5
XML Drawables
Shapes: Rectangle Oval Line Ring
Fills Solid, Gradient
Strokes & Corners Padding (applies to Views) Support for Layers
5
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.
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
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’
9
Activities with Results
Request Code is passed into the intent.
Result Code for OK, Cancel
Intent containing any extra result data.
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
11
Demo Time
PicNotes – simple proof of concept to show off all this stuff.
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