a lap around android part 2

13
A Lap Around Android II Ben Monro June 26, 2010 SoCalCodeCamp

Upload: ben-monro

Post on 17-May-2015

519 views

Category:

Technology


5 download

DESCRIPTION

A Lap Around Android II Presentation from SoCal Code Camp June 26 2010

TRANSCRIPT

Page 1: A Lap Around Android Part 2

A Lap Around Android IIBen Monro

June 26, 2010SoCalCodeCamp

Page 2: A Lap Around Android Part 2

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

Preference Screens

Unified XML Based Simple Customizable

Page 4: A Lap Around Android Part 2

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

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

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

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

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

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

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

11

Demo Time

PicNotes – simple proof of concept to show off all this stuff.

Page 12: A Lap Around Android Part 2

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

Page 13: A Lap Around Android Part 2

13

Q&A

Rate Me on SpeakerRate:http://speakerrate.com/benmonro