25
Android for Java Developers Denver Java Users Group Jan 11, 2012 -Mike Wolfson @mikewolfson

Android For Java Developers

Embed Size (px)

DESCRIPTION

This presentation was given at

Citation preview

Page 1: Android For Java Developers

Android for Java Developers

Denver Java Users Group

Jan 11, 2012

-Mike Wolfson

@mikewolfson

Page 2: Android For Java Developers

Why Android?

Open APIs – everyone’s equal Low Barrier to entry

Run app on your own device - $0Sell through Google Market - $25

Easy to develop apps Especially for Java DevelopersPlatform agnostic

Open Market (or download from anywhere) Feature Rich platform

Page 3: Android For Java Developers

Framework Overview

http://developer.android.com/guide/basics/what-is-android.html

Page 4: Android For Java Developers

Framework – Linux Kernel

Core system services

Handles security, memory management, process management, network access, etc

Abstraction layer between OS and hardware

Page 5: Android For Java Developers

Framework - Dalvik

Virtual Machine Optimized for mobile devices Every app runs in its own instance of VM Runs classes compiled by Java, and transformed

into .dex files

Page 6: Android For Java Developers

Framework - Libraries

Variety of libraries to provide built in functionality.

Page 7: Android For Java Developers

Framework – Application Framework

Provides functionality to allow Applications to interact with underlying OS and other applications

Designed to simplify the reuse of components, and allow applications to publish, or make use of the capabilities of other applications

Page 8: Android For Java Developers

Framework – Applications

The layer where custom-built applications live.

This is the place where most mobile developers will interact with Android.

Your App Here!

Page 9: Android For Java Developers

Framework Overview

Page 10: Android For Java Developers

Get Developer Tools

SDK http://developer.android.com/sdk/index.html Requires Java SDK (5.0 +) Updating versions What the different versions mean

ADT Plugin (for Eclipse) http://developer.android.com/guide/developing/tools/adt.html Need Eclipse Ganymede (3.4+) Update site: https://dl-ssl.google.com/android/eclipse

Can develop without Eclipse

Page 11: Android For Java Developers

Developer Tools (cont)

Android command Emulator

Android Virtual Devices (AVD) Android Debug Bridge (ADB)

Command line tool for interacting with phone/emulator.

Dalvik Debug Monitor Server (DDMS)Debugging tool providing: screen capture, memory

info, logging, info spoofing)http://developer.android.com/guide/developing/tools/index.html

Page 12: Android For Java Developers

Developing an App

1. Create a new project Project content overview

2. Code

3. Test on emulator (or device)

4. Debug

5. Sign

6. Export to device As APK (Android PacKage file)

Page 13: Android For Java Developers

Terminology

Most Commonly used elements• Activity

• Intent

• Manifest file

• Resources and Assets

• Layout

• Fragment

Page 14: Android For Java Developers

Terminology - Layout

Layout – describes the UI of an activity Enables separation of UI from

logicThere are a variety of layouts you

can use including: Linear, Table, Relative, and Frame

Page 15: Android For Java Developers

Terminology - Activity

Activity – (Noun) A single screen, your application is made up of one or more of these.Always extends Activity

Page 16: Android For Java Developers

Terminology - Intent

Intent – (Verb) code to perform an action Wiring between activities, services,

broadcast receivers, or other functionsfacility for late run-time binding between

components in the same or different applications

Rich set of Intent in Android provide excellent way of executing specific actions

Page 17: Android For Java Developers

Fragments

Fragments represent a behavior or portion of a UI.

Designed to collect a unit of UI and behavior into a reusable component

Don’t have own lifecycle – and must be embedded in an Activity

Page 18: Android For Java Developers

Fragments

Page 19: Android For Java Developers

Terminology - Manifest

Manifest File – describes your app always named AndroidManifest.xml declares the components of an

application, describes security permissions required by the app, and lists required library dependencies

Page 20: Android For Java Developers

Terminology - Resources

Resource – text, pictures, sound, etcare all abstracted from the code and

logiccompiled and managed by system

generated R.class fileInstantiate by getting reference to

object

Page 21: Android For Java Developers

Resources

Multiple Layouts and Graphic Assets

Can also be Used for language localization

Tip: use Density Independent Pixels (DP)

Draw9Patch

Page 22: Android For Java Developers

Terminology - APK

Android Application File User can install apps from many sources Developer can upload updates easily

Page 23: Android For Java Developers

Terminology – cont.

Other important elements• Widget

• Service

• Broadcast Receiver

• Security and Permission

• Content Provider

Page 24: Android For Java Developers

Learn More

http://developer.android.com Denver Droids

http://www.denverdroids.com/ http://forum.xda-developers.com http://www.stackoverflow.com http://developer.android.com Google Groups (Forums)

Page 25: Android For Java Developers

Questions?

@mikewolfson Google +: Mike Wolfson [email protected] Slideshare:

http://www.slideshare.net/mswolfson Dropbox:

http://dl.dropbox.com/u/23589031/DJUG.zip Beer?!