android development - the basics, fi muni, 2012

29
Android Development - the basics Tomáš Kypta @TomasKypta

Upload: tomas-kypta

Post on 13-Jul-2015

964 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Android development - the basics, FI MUNI, 2012

Android Development- the basics

Tomáš Kypta@TomasKypta

Page 2: Android development - the basics, FI MUNI, 2012
Page 3: Android development - the basics, FI MUNI, 2012
Page 4: Android development - the basics, FI MUNI, 2012

Outline

● Android platform● Android ecosystem● Android SDK and development tools● Hello World● Building blocks & the manifest file● Activities, widgets, intents● Dialog, toast

Page 5: Android development - the basics, FI MUNI, 2012

Android platform

● Linux-based operating system● open-source● originally phone OS● tablet (since Honeycomb)● Google TV● hundreds of devices

Page 6: Android development - the basics, FI MUNI, 2012
Page 7: Android development - the basics, FI MUNI, 2012

History

● 2003, Android inc.● 2005 acquired by Google● 2008 first Android phone – T-Mobile G1

● since then rapid development of the platform

Page 8: Android development - the basics, FI MUNI, 2012

Android ecosystem

● the world's most popular mobile platform● over 850 000 new devices activated each day● total number of devices ~ 300 million

● play.google.com (market.android.com)● more than 450 000 applications● ~ 70% free apps

Page 9: Android development - the basics, FI MUNI, 2012

Problems

● fragmentation● manufacturer/carrier enhancements● updates & support● openness – low quality apps● malware (users)

Page 10: Android development - the basics, FI MUNI, 2012

Sources

● developer.android.com● android-developers.blogspot.com● source.android.com● stackoverflow.com● youtube.com/androiddevelopers● svetandroida.cz

Page 11: Android development - the basics, FI MUNI, 2012

Development

● programming in “Java”● native apps possible (C++)

● development tools platform friendly● Windows, Linux, Mac OS X● IDE support – ADT plugin for Eclipse,

Netbeans, IntelliJ IDEA, ...

Page 12: Android development - the basics, FI MUNI, 2012

Android SDK● android – Android SDK and AVD Manager● adb – Android Debug Bridge● ddms – Dalvik Debug Monitor● emulator● hierarchyviewer● ProGuard● Traceview● docs

Page 13: Android development - the basics, FI MUNI, 2012

Libraries

● compatibility libraries● licensing library

● AdMob● Google Analytics, Flurry● C2DM

Page 14: Android development - the basics, FI MUNI, 2012

Android internals

Page 15: Android development - the basics, FI MUNI, 2012

Hello World

Page 16: Android development - the basics, FI MUNI, 2012

Android Building Blocks

● Activity● Service● Content provider● Broadcast receiver

● AndroidManifest.xml

Page 17: Android development - the basics, FI MUNI, 2012

Activity

● screen with user interface● the only visual component

● examples:– list of emails

– email detail

– email composition

Page 18: Android development - the basics, FI MUNI, 2012

Service

● runs in background● long-running tasks

● examples:– music playback service

– download service

– sync service

Page 19: Android development - the basics, FI MUNI, 2012

Content Provider

● manages and shares application data● data storage doesn't matter – database, web,

filesystem● apps can query and modify data through

content provider● read/write permissions can be defined● examples:

– all system databases

– contacts

– SMS

Page 20: Android development - the basics, FI MUNI, 2012

Broadcast Receiver

● responds to broadcasts● broadcasts are system wide● can be registered statically or dynamically● system or custom messages● examples:

– incoming SMS, incoming call

– screen turned off

– low baterry

– removed SD card

Page 21: Android development - the basics, FI MUNI, 2012

AndroidManifest.xml

● defines what parts the app have● defines which endpoints are exposed● minimum API level● permissions● declare hardware and software features● required configuration

Page 22: Android development - the basics, FI MUNI, 2012

Intent

● asynchronous message● binds components together (all of them

except ContentProvider)● starting activities● starting services and binding to services● sending broadcasts

Page 23: Android development - the basics, FI MUNI, 2012

User Interface

● defined by hierarchy of views● layouts = containers

– LinearLayout

– RelativeLayout

– FrameLayout

● widgets = UI objects– Button, TextView, EditText

– WebView

Page 24: Android development - the basics, FI MUNI, 2012

Activity Lifecycle

● activities managed in a stack● activity can be in different states during it's

lifecycle:– foreground

– visible

– stopped

– killed

Page 25: Android development - the basics, FI MUNI, 2012
Page 26: Android development - the basics, FI MUNI, 2012

Intent & Activity

● starting activity explicitly

● starting activity implicitly

● starting activity for result

Page 27: Android development - the basics, FI MUNI, 2012

List Widgets

● displays a list of items (some view)– ListView, Spinner, GridView, Gallery

● use adapter to bind list to data

Page 28: Android development - the basics, FI MUNI, 2012

Dialogs and Toasts

● Dialog – displays modal information– standard dialogs

– custom dialogs

● Toast – non-modal information – doesn't have user focus

Page 29: Android development - the basics, FI MUNI, 2012

THE END