Vous êtes sur la page 1sur 38

Online Seminar

Introduction to
Android Development
Part 1
So, you wanna build an app?
Konrad Grski
JLC Gdask

Whos this guy?


Konrad Grski

fb.com/konradgrski
twitter.com/konrad_gorski

JLC Gdask
Co-creator of Split It!

Cant see? Try HD!

Whats the plan?


2x 45min

Introduction
The System
The Tools

The Apps

Why mobile dev?


Easy access to customers
Low entry barrier
Business opportunities

Why Android?
Popularity
Availability
Community support

Introduction
The System
The Tools
The Apps

What is Android?
An OS

A framework

Linux kernel

API for developers

Runtime

Android ecosystem:
Google Services

(Dalvik VM + libraries:
WebKit, Media, SQLite etc.)

End-user apps

What is Android?

Androids not one device

E
V
!

CPU architectures

LI
A

Vendor add-ons

Screen sizes

IT

Platform versions

Fragmentation
API 16-18

API 19

API 14-15

http://developer.android.com/about/dashboards/index.html

API 9-10

Introduction
The System
The Tools
The Apps

Getting started
Google android sdk
developer.android.com/sdk/
Download & unpack the ADT Bundle
Run eclipse

Whats inside?
Eclipse - the IDE
Android SDK
System image (for emulator)
Emulator instance

Running my app
Physical device
Fast, compatible
Hardware features

Emulator
Different screen sizes
Host GPU / HAXM / GenyMotion if too sluggish

Logcat
Useful debugging tool:
Log.d(MyActivity, App launched!);

Quick question #1
You used an API method from API14. You run
the app on an API10-device. What happens?
A. nothing
B. app crashes
C. it wouldnt even compile

Quick question #1
You used an API method from API14. You run
the app on an API10-device. What happens?
A. nothing
B. app crashes
C. it wouldnt even compile
LINT error

Introduction
The System
The Tools
The Apps

General considerations
Mobile app?
Always ready to wrap up
Part of the environment
Highly context-dependent

General considerations
Mobile app?
Always ready to wrap up
Part of the environment
Highly context-dependent

General considerations
Mobile app?
Always ready to wrap up
Part of the environment
Highly context-dependent

First project

Oh, theres a wizard...

First project
Warning: Scumbag Wizard

image: quickmeme.com

Whats inside?
src

source (.java)

res

resources (.xml, .png)

libs

libraries (.jar, .so)

assets

misc files (.ttf, .html...)

XML resources
Layouts

layout/my_super_layout.xml
layout-land/my_super_layout.xml

Translations

values/strings.xml
values-es/strings.xml

Drawables
Dimensions
Animations

Parts of an app
Activity
View

Activity
View

View

UI

Intent

Non-UI

Fragment

Broadcast

Intent
Service

BroadcastReceiver

ContentProvider

Fancy a break?

Back in 10 minutes!
io

ns

t
s
e

s
o
P

u
q
t

if

u
o
y

v
a
h

y
an

Ordnung muss sein


AndroidManifest.xml
Activities, Services, global BroadcastReceivers
IntentFilters
Permissions
...

The Hollywood rule


Dont call us, well call you!

Activity
Activity

The lifecycle

Whole-screen UI
controller

Views organized in
layouts

Manages Fragments

onCreate

Peculiar lifecycle

onStart

onResume

onPause

onStop

onDestroy

Lets create one...

View
UI control
Inflated from XML or created in Java
Can be nested (tree)

Sample View types


TextView

ListView

Button

Layouts are Views, too


LinearLayout

img: developer.android.

RelativeLayout

FrameLayout

Quick question #2
Q: Can an app have no UI at all?

Quick question #2
Q: Can an app have no UI at all?
A: Yes!
Our app
Network status
change

System
broadcast

BroadcastReceiver

Service

Navigating through the app


Moving from one Activity to another:
using Intent class

Intents:
Explicit: Intent(this,

MyNextActivity.class);

Implicit: Intent(Intent.ACTION_VIEW);

Extras

Summary
Android development - more than coding
Activities and fragments host UI behavior
Think of layouts in functional terms
Intents express where you want to go

Question time!

Thats all, folks!


See you in January :)

Vous aimerez peut-être aussi