SlideShare a Scribd company logo
1 of 51
Download to read offline
Android	
  for	
  Java	
  
  Developers	
  
 OSCON	
  2010	
  

    Marko	
  Gargenta	
  
      Marakana	
  
About	
  Marko	
  Gargenta	
  
Developed Android Bootcamp for Marakana.

Trained over 1,000 developers on Android.

Clients include Qualcomm, Sony-Ericsson, Motorola,
Texas Instruments, Cisco, Sharp, DoD.

Author of upcoming Learning Android by O’Reilly.

Spoke at OSCON, ACM, IEEE, SDC. Organizes
SFAndroid.org
Agenda	
  
•    The	
  Stack	
  
•    Android	
  SDK	
  
•    Hello	
  World!	
  
•    Main	
  Building	
  Blocks	
  
•    Android	
  User	
  Interface	
  
•    OperaIng	
  System	
  Features	
  
•    Debugging	
  
•    Summary	
  
ANDROID	
  STACK	
  
The	
  Stack	
  
Linux	
  Kernel	
  
Android runs on Linux.                                        Applications


                                    Home      Contacts          Phone             Browser              Other

Linux provides as well as:
    Hardware abstraction layer                            Application Framework
    Memory management              Activity        Window                    Content                   View

    Process management
                                   Manager         Manager                  Providers                 System

                                   Package    Telephony         Resource           Location            Notiication
    Networking                     Manager     Manager          Manager            Manager             Manager


                                                                Libraries
Users never see Linux sub system   Surface       Media
                                                                   SQLite                  Android Runtime
                                   Manager     Framework

                                                                                                 Core Libs

The adb shell command opens        OpenGL      FreeType            WebKit

                                                                                                  Delvik
Linux shell                          SGL          SSL               libc
                                                                                                   VM




                                    Display    Camera         Linux Kernel              Flash                Binder
                                    Driver      Driver                                  Driver               Driver

                                    Keypad      WiFi                                    Audio                Power
                                     Driver     Driver                                  Driver               Mgmt
NaIve	
  Libraries	
  
Bionic, a super fast and small                              Applications


license-friendly libc library     Home      Contacts          Phone             Browser              Other

optimized for embedded use
                                                        Application Framework
Surface Manager for composing    Activity        Window                    Content                   View

window manager with off-screen   Manager         Manager                  Providers                 System


buffering
                                 Package    Telephony         Resource           Location            Notiication
                                 Manager     Manager          Manager            Manager             Manager


                                                              Libraries
2D and 3D graphics hardware      Surface       Media
                                                                 SQLite                  Android Runtime
support or software simulation
                                 Manager     Framework

                                                                                               Core Libs
                                 OpenGL      FreeType            WebKit

                                                                                                Delvik
Media codecs offer support for     SGL          SSL               libc
                                                                                                 VM

major audio/video codecs
                                  Display    Camera         Linux Kernel              Flash                Binder
                                                                                      Driver               Driver
SQLite database
                                  Driver      Driver

                                  Keypad      WiFi                                    Audio                Power
                                   Driver     Driver                                  Driver               Mgmt


WebKit library for fast HTML
rendering
Dalvik	
  


Dalvik VM is Google’s implementation of
Java VM

Optimized for mobile devices

Key Dalvik differences:
    - Register-based versus stack-based VM
    - Dalvik runs .dex files
    - More efficient and compact implementation
    - Different set of Java libraries than SDK
ApplicaIon	
  Framework	
  
The rich set of system services                                Applications


wrapped in an intuitive Java API.    Home      Contacts          Phone             Browser              Other




This ecosystem that developers                             Application Framework
can easily tap into is what makes   Activity        Window                    Content                   View

writing apps for Android easy.
                                    Manager         Manager                  Providers                 System

                                    Package    Telephony         Resource           Location            Notiication
                                    Manager     Manager          Manager            Manager             Manager


Location, web, telephony, WiFi,                                  Libraries
Bluetooth, notifications, media,    Surface
                                    Manager
                                                  Media
                                                Framework
                                                                    SQLite                  Android Runtime

camera, just to name a few.                                                                       Core Libs
                                    OpenGL      FreeType            WebKit

                                                                                                   Delvik
                                                                                                    VM
                                      SGL          SSL               libc




                                     Display    Camera         Linux Kernel              Flash                Binder
                                     Driver      Driver                                  Driver               Driver

                                     Keypad      WiFi                                    Audio                Power
                                      Driver     Driver                                  Driver               Mgmt
ApplicaIons	
  




Dalvik Executable + Resources = APK
Must be signed (but debug key is okay
for development)
Many markets with different policies
Android	
  and	
  Java	
  

Android Java =
Java SE –
AWT/Swing +
Android API
Android	
  SDK	
  -­‐	
  What’s	
  in	
  the	
  box
                                                     	
  
SDK

Tools
Docs
Platforms
     Data
     Skins
     Images
     Samples
Add-ons
     Google
HELLO	
  WORLD!	
  
Create	
  New	
  Project
                                         	
  
Use the Eclipse tool to create a new
Android project.

Here are some key constructs:


Project	
          Eclipse	
  construct	
  
Target	
           minimum	
  to	
  run	
  
App	
  name	
      whatever	
  
Package	
          Java	
  package	
  
AcIvity	
          Java	
  class	
  
The	
  Manifest	
  File	
  
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
   package="com.marakana"
   android:versionCode="1"
   android:versionName="1.0">
  <application android:icon="@drawable/icon"
         android:label="@string/app_name">
    <activity android:name=".HelloAndroid"
           android:label="@string/app_name">
       <intent-filter>
          <action android:name="android.intent.action.MAIN" />
          <category android:name="android.intent.category.LAUNCHER" />
       </intent-filter>
    </activity>
  </application>
  <uses-sdk android:minSdkVersion="5" />
</manifest>
The	
  Layout	
  Resource	
  

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:orientation="vertical"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  >
<TextView
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  android:text="@string/hello"
  />
</LinearLayout>
The	
  Java	
  File	
  
package com.marakana;

import android.app.Activity;
import android.os.Bundle;

public class HelloAndroid extends Activity {
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
     super.onCreate(savedInstanceState);
     setContentView(R.layout.main);
  }
}
Running	
  on	
  Emulator
                        	
  
MAIN	
  BUILDING	
  BLOCKS	
  
AcIviIes
                       	
  
Activity is to an    Android Application

application what a       Main Activity
                                           Another    Another
                                           Activity   Activity
web page is to a
website. Sort of.
AcIvity	
  Lifecycle	
  
                                                         Starting




Activities have a well-
                                                     (1) onCreate()
                                                      (2) onStart()
                                              (3) onRestoreInstanceState()

defined lifecycle. The                              (4) onResume()


Android OS manages
your activity by                                         Running


changing its state.       (3) onResume()
                            (2) onStart()
                                                                               (1) onSaveInstanceState()
                                                                                     (2) onPause()

You fill in the blanks.
                           (1) onRestart()                    onResume()


                                                  (1) onSaveInstanceState()
                            Stopped                      (2) onStop()                     Paused



                                 onDestroy()
                                     or                                       <process killed>
                               <process killed>

                                                        Destroyed
Intents
                               	
  
Intents represent
                        Android Application
an events or
actions.                    Main Activity     Intent
                                                         Another
                                                         Activity


They are to




                                                            Intent
Android apps what
hyperlinks are to       Android Application
websites. Sort of.                                       Another
                            Main Activity       Intent   Activity

Intents can be
implicit or explicit.
Services
                          	
  
Services are code that runs in the background. They
can be started and stopped. Services doesn’t have
UI.
Service	
  Lifecycle	
  
Service also has a                                     Starting

lifecycle, but it’s                                                          (1) onCreate()
much simpler than                                                             (2) onStart()


activity’s.                                onStart()



An activity typically     Stopped                                                Running

starts and stops a
service to do some                                                onStop()

work for it in the
background, such as       onDestroy()
                              or

play music, check for
                        <process killed>
                                                  Destroyed

new tweets, etc.
Content	
  Providers
                               	
  
Content Providers share                    Content
content with applications                  Provider

across application           Content URI

boundaries.                    insert()

Examples of built-in          update()

Content Providers are:         delete()

Contacts, MediaStore,          query()

Settings and more.
Broadcast	
  Receivers
                                	
  




An Intent-based publish-subscribe mechanism. Great for listening
system events such as SMS messages.
MyTwiVer	
  –	
  A	
  Real	
  World	
  App	
  
                                                                Update list


MyTwitter              Preference                                                   Timeline
 Activity                                               Timeline
                         Activity                                                    Activity
                                                        Receiver




                       Read/write                        Notify of
                       preferences                      new status               Update ListView
               Read
               Prefs      Prefs
                          XML                                                       Timeline
  Updates
  Status via                                                                        Adapter
 web service                                            Updater
                                     Read
                                     Prefs              Service
                                                                                  Pull timeline
                                                                                   from DB
                                                                        Insert
                        Pull timeline
                                                                       updates
                        updates via
                                                                        in DB
                        web service                      Start at
       Twitter.com                                                                  Timeline
                                                          boot
                                                                                      DB

                                              Boot
                                             Receiver
ANDROID	
  USER	
  INTERFACE	
  
Two	
  UI	
  Approaches	
  
Procedural	
                              Declara?ve	
  
You	
  write	
  Java	
  code	
            You	
  write	
  XML	
  code	
  
Similar	
  to	
  Swing	
  or	
  AWT	
     Similar	
  to	
  HTML	
  of	
  a	
  web	
  page	
  




You can mix and match both styles.
Declarative is preferred: easier and
more tools
XML-­‐Based	
  User	
  Interface	
  




Use WYSIWYG tools to build powerful XML-based UI.
Easily customize it from Java. Separate concerns.
Dips	
  and	
  Sps	
  

px	
  (pixel)	
                                 Dots	
  on	
  the	
  screen	
  
in	
  (inches)	
                                Size	
  as	
  measured	
  by	
  a	
  ruler	
  
mm	
  (millimeters)	
                           Size	
  as	
  measured	
  by	
  a	
  ruler	
  
pt	
  (points)	
                                1/72	
  of	
  an	
  inch	
  
dp	
  (density-­‐independent	
  pixel)	
        Abstract	
  unit.	
  On	
  screen	
  with	
  160dpi,	
  
                                                1dp=1px	
  
dip	
                                           synonym	
  for	
  dp	
  and	
  ocen	
  used	
  by	
  Google	
  
sp	
                                            Similar	
  to	
  dp	
  but	
  also	
  scaled	
  by	
  users	
  font	
  
                                                size	
  preference	
  
Views	
  and	
  Layouts
                          	
  

                    ViewGroup




        ViewGroup               View




 View     View      View




Layouts contain other Views, or
other Layouts.
Common	
  UI	
  Components
                                	
  
Android UI includes many
common modern UI
widgets, such as Buttons,
Tabs, Progress Bars, Date
and Time Pickers, etc.
SelecIon	
  Components
                             	
  

Some UI widgets may
be linked to zillion
pieces of data.
Examples are ListView
and Spinners
(pull-downs).
Adapters
                         	
  


                      Adapter       Data
                                   Source




To make sure they run smoothly, Android uses
Adapters to connect them to their data sources. A
typical data source is an Array or a Database.
Complex	
  Components
                            	
  
Certain high-level components are simply
available just like Views. Adding a Map or a
Video to your application is almost like adding a
Button or a piece of text.
Menus	
  and	
  Dialogs
                      	
  
Graphics	
  &	
  AnimaIon	
  
Android has rich support for 2D graphics.
You can draw & animate from XML.
You can use OpenGL for 3D graphics.
MulImedia	
  
AudioPlayer lets you simply specify
the audio resource and play it.

VideoView is a View that you can
drop anywhere in your activity, point
to a video file and play it.

XML:
<VideoView
  android:id="@+id/video"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:layout_gravity="center” />

Java:
player = (VideoView) findViewById(R.id.video);
player.setVideoPath("/sdcard/samplevideo.3gp");
player.start();
OPERATING	
  SYSTEM	
  FEATURES	
  	
  
Security	
  
Each Android application            Android Application
runs inside its own Linux
process.                                     Linux Process
Additionally, each application
has its own sandbox file                                   File
system with its own set of                     Prefs
                                       DB                 System
preferences and its own
database.

Other applications cannot
access any of its data,
unless it is explicitly shared.
File	
  System	
  
The file system has three main mount points. One
for system, one for the apps, and one for whatever.

Each app has its own sandbox easily accessible to
it. No one else can access its data. The sandbox is
in /data/data/com.marakana/

SDCard is expected to always be there. It’s a good
place for large files, such as movies and music.
Everyone can access it.
Cloud	
  to	
  Device	
  Push	
  




Big deal for many pull-based apps. Will make devices use less battery.
Preferences
                                   	
  

Your app can support complex
preferences quite easily.

You define your preferences in an
XML file and the corresponding UI and
data storage is done for free.
SQLite	
  Database	
  
Android ships with SQLite3

SQLite is

Zero configuration
Serverless
Single database file
Cross-Platform
Compact
Public Domain

Database engine.


            May you do good and not evil
            May you find forgiveness for yourself and forgive others
            May you share freely, never taking more than you give.
DEBUGGING	
  	
  
ANDROID	
  APPS	
  
LogCat
                              	
  
The universal, most
versatile way to track
what is going on in
your app.

Can be viewed via
command line or
Eclipse.

Logs can be
generated both from
SDK Java code, or
low-level C code via
Bionic libc extension.
Debugger
                                    	
  




Your standard debugger is included in SDK, with all the usual bells & whistles.
TraceView	
  




TraceView helps you profile you application and find bottlenecks. It shows
execution of various calls through the entire stack. You can zoom into specific
calls.
Hierarchy	
  Viewer
                                          	
  
Hierarchy Viewer helps
you analyze your User
Interface.

Base UI tends to be the
most “expensive” part of
your application, this tool
is very useful.
Summary	
  
     Android is open and complete system for
     mobile development. It is based on Java
     and augmented with XML.

     Android is being adopted very quickly
     both by users, carriers, and
     manufacturers.

     It takes about 3-5 days of intensive
     training to learn Android application
     development for someone who has basic
     Java (or similar) experience.

     Marko Gargenta, Marakana.com
     marko@marakana.com
     +1-415-647-7000
     Licensed under Creative Commons
     License (cc-by-nc-nd) – non-commercial.
     Please Share!

More Related Content

What's hot

An Introduction To Android
An Introduction To AndroidAn Introduction To Android
An Introduction To AndroidGoogleTecTalks
 
Android Services Black Magic by Aleksandar Gargenta
Android Services Black Magic by Aleksandar GargentaAndroid Services Black Magic by Aleksandar Gargenta
Android Services Black Magic by Aleksandar GargentaMarakana Inc.
 
The anatomy and philosophy of Android - Google I/O 2009
The anatomy and philosophy of Android - Google I/O 2009The anatomy and philosophy of Android - Google I/O 2009
The anatomy and philosophy of Android - Google I/O 2009Viswanath J
 
Android Beyond The Phone
Android Beyond The PhoneAndroid Beyond The Phone
Android Beyond The PhoneMarko Gargenta
 
Tacademy techclinic-2012-07-11
Tacademy techclinic-2012-07-11Tacademy techclinic-2012-07-11
Tacademy techclinic-2012-07-11영호 라
 
Droid con berlin_the_bb10_android_runtime
Droid con berlin_the_bb10_android_runtimeDroid con berlin_the_bb10_android_runtime
Droid con berlin_the_bb10_android_runtimeDroidcon Berlin
 
Introduction To Android
Introduction To AndroidIntroduction To Android
Introduction To Androidma-polimi
 
Systems Resource Management with NetIQ AppManager
Systems Resource Management with NetIQ AppManagerSystems Resource Management with NetIQ AppManager
Systems Resource Management with NetIQ AppManagerAdvanced Logic Industries
 
Slides bootcamp21
Slides bootcamp21Slides bootcamp21
Slides bootcamp21dxsaki
 
Android : How Do I Code Thee?
Android : How Do I Code Thee?Android : How Do I Code Thee?
Android : How Do I Code Thee?Viswanath J
 
Android architecture
Android architectureAndroid architecture
Android architectureHari Krishna
 
Android unveiled (I)
Android unveiled (I)Android unveiled (I)
Android unveiled (I)denian00
 
Webinar The App Lifecycle Platform
Webinar The App Lifecycle PlatformWebinar The App Lifecycle Platform
Webinar The App Lifecycle PlatformService2Media
 
Open Source Licenses and Tools
Open Source Licenses and ToolsOpen Source Licenses and Tools
Open Source Licenses and Toolsg2ix
 
Mee go是您的新机遇
Mee go是您的新机遇Mee go是您的新机遇
Mee go是您的新机遇OpenSourceCamp
 
Droid con 2012 bangalore v2.0
Droid con 2012   bangalore v2.0Droid con 2012   bangalore v2.0
Droid con 2012 bangalore v2.0Premchander Rao
 
Codendi Datasheet
Codendi DatasheetCodendi Datasheet
Codendi DatasheetCodendi
 
Nokia Qt SDK in action - Qt developer days 2010
Nokia Qt SDK in action - Qt developer days 2010Nokia Qt SDK in action - Qt developer days 2010
Nokia Qt SDK in action - Qt developer days 2010Nokia
 

What's hot (20)

Android Internals
Android InternalsAndroid Internals
Android Internals
 
An Introduction To Android
An Introduction To AndroidAn Introduction To Android
An Introduction To Android
 
Android Services Black Magic by Aleksandar Gargenta
Android Services Black Magic by Aleksandar GargentaAndroid Services Black Magic by Aleksandar Gargenta
Android Services Black Magic by Aleksandar Gargenta
 
The anatomy and philosophy of Android - Google I/O 2009
The anatomy and philosophy of Android - Google I/O 2009The anatomy and philosophy of Android - Google I/O 2009
The anatomy and philosophy of Android - Google I/O 2009
 
Android Beyond The Phone
Android Beyond The PhoneAndroid Beyond The Phone
Android Beyond The Phone
 
Tacademy techclinic-2012-07-11
Tacademy techclinic-2012-07-11Tacademy techclinic-2012-07-11
Tacademy techclinic-2012-07-11
 
Droid con berlin_the_bb10_android_runtime
Droid con berlin_the_bb10_android_runtimeDroid con berlin_the_bb10_android_runtime
Droid con berlin_the_bb10_android_runtime
 
Introduction To Android
Introduction To AndroidIntroduction To Android
Introduction To Android
 
Systems Resource Management with NetIQ AppManager
Systems Resource Management with NetIQ AppManagerSystems Resource Management with NetIQ AppManager
Systems Resource Management with NetIQ AppManager
 
Slides bootcamp21
Slides bootcamp21Slides bootcamp21
Slides bootcamp21
 
Android : How Do I Code Thee?
Android : How Do I Code Thee?Android : How Do I Code Thee?
Android : How Do I Code Thee?
 
Android architecture
Android architectureAndroid architecture
Android architecture
 
Android unveiled (I)
Android unveiled (I)Android unveiled (I)
Android unveiled (I)
 
Webinar The App Lifecycle Platform
Webinar The App Lifecycle PlatformWebinar The App Lifecycle Platform
Webinar The App Lifecycle Platform
 
Open Source Licenses and Tools
Open Source Licenses and ToolsOpen Source Licenses and Tools
Open Source Licenses and Tools
 
Mee go是您的新机遇
Mee go是您的新机遇Mee go是您的新机遇
Mee go是您的新机遇
 
Droid con 2012 bangalore v2.0
Droid con 2012   bangalore v2.0Droid con 2012   bangalore v2.0
Droid con 2012 bangalore v2.0
 
Android primer
Android primerAndroid primer
Android primer
 
Codendi Datasheet
Codendi DatasheetCodendi Datasheet
Codendi Datasheet
 
Nokia Qt SDK in action - Qt developer days 2010
Nokia Qt SDK in action - Qt developer days 2010Nokia Qt SDK in action - Qt developer days 2010
Nokia Qt SDK in action - Qt developer days 2010
 

Viewers also liked

Mães na Internet e o Cenário em Cuiabá
Mães na Internet e o Cenário em CuiabáMães na Internet e o Cenário em Cuiabá
Mães na Internet e o Cenário em CuiabáMatheus Moraes
 
Digi-Art Sites
Digi-Art SitesDigi-Art Sites
Digi-Art Sitestopher
 
Insider trading_in_turkey
Insider trading_in_turkeyInsider trading_in_turkey
Insider trading_in_turkeyguest0437b8
 
Smart%20 Manual%20rev20060403
Smart%20 Manual%20rev20060403Smart%20 Manual%20rev20060403
Smart%20 Manual%20rev20060403guest4fb07c
 
TRATADO DE GINEBRA
TRATADO DE GINEBRATRATADO DE GINEBRA
TRATADO DE GINEBRAguest605b6fd
 
From Stats to Strats - Using Social Media Statistics to Plan an Integrated Ma...
From Stats to Strats - Using Social Media Statistics to Plan an Integrated Ma...From Stats to Strats - Using Social Media Statistics to Plan an Integrated Ma...
From Stats to Strats - Using Social Media Statistics to Plan an Integrated Ma...Kayak Online Marketing
 
Hands-on User Experience
Hands-on User ExperienceHands-on User Experience
Hands-on User ExperienceDirk Huysmans
 
Ogc in arc_gis_g_tstyle
Ogc in arc_gis_g_tstyleOgc in arc_gis_g_tstyle
Ogc in arc_gis_g_tstyleGert-Jan
 
Laserfiche document management solutions
Laserfiche document management solutionsLaserfiche document management solutions
Laserfiche document management solutionsrobnjoro
 
myStratex Workshop Pack
myStratex Workshop PackmyStratex Workshop Pack
myStratex Workshop PackFabStart
 
Tumblr - guida alla piattaforma e opportunità (free webinar)
Tumblr - guida alla piattaforma e opportunità (free webinar)Tumblr - guida alla piattaforma e opportunità (free webinar)
Tumblr - guida alla piattaforma e opportunità (free webinar)Artlandis' Webinar & Workshop
 
#fotocasaResponde: ¿Cómo reclamar la devolución de las cláusulas suelo?
#fotocasaResponde: ¿Cómo reclamar la devolución de las cláusulas suelo?#fotocasaResponde: ¿Cómo reclamar la devolución de las cláusulas suelo?
#fotocasaResponde: ¿Cómo reclamar la devolución de las cláusulas suelo?fotocasa
 
FNPW and Preserving Planet Earth
FNPW and Preserving Planet EarthFNPW and Preserving Planet Earth
FNPW and Preserving Planet EarthLeisure Solutions®
 

Viewers also liked (20)

Mães na Internet e o Cenário em Cuiabá
Mães na Internet e o Cenário em CuiabáMães na Internet e o Cenário em Cuiabá
Mães na Internet e o Cenário em Cuiabá
 
Digi-Art Sites
Digi-Art SitesDigi-Art Sites
Digi-Art Sites
 
Insider trading_in_turkey
Insider trading_in_turkeyInsider trading_in_turkey
Insider trading_in_turkey
 
Smart%20 Manual%20rev20060403
Smart%20 Manual%20rev20060403Smart%20 Manual%20rev20060403
Smart%20 Manual%20rev20060403
 
TRATADO DE GINEBRA
TRATADO DE GINEBRATRATADO DE GINEBRA
TRATADO DE GINEBRA
 
Iss
IssIss
Iss
 
Portfolio of work
Portfolio of workPortfolio of work
Portfolio of work
 
Shakira
ShakiraShakira
Shakira
 
From Stats to Strats - Using Social Media Statistics to Plan an Integrated Ma...
From Stats to Strats - Using Social Media Statistics to Plan an Integrated Ma...From Stats to Strats - Using Social Media Statistics to Plan an Integrated Ma...
From Stats to Strats - Using Social Media Statistics to Plan an Integrated Ma...
 
Hands-on User Experience
Hands-on User ExperienceHands-on User Experience
Hands-on User Experience
 
Connectonomics
ConnectonomicsConnectonomics
Connectonomics
 
Ogc in arc_gis_g_tstyle
Ogc in arc_gis_g_tstyleOgc in arc_gis_g_tstyle
Ogc in arc_gis_g_tstyle
 
Laserfiche document management solutions
Laserfiche document management solutionsLaserfiche document management solutions
Laserfiche document management solutions
 
myStratex Workshop Pack
myStratex Workshop PackmyStratex Workshop Pack
myStratex Workshop Pack
 
What Is Social Media[1]
What Is Social Media[1]What Is Social Media[1]
What Is Social Media[1]
 
Y in the Workplace
Y in the WorkplaceY in the Workplace
Y in the Workplace
 
Tumblr - guida alla piattaforma e opportunità (free webinar)
Tumblr - guida alla piattaforma e opportunità (free webinar)Tumblr - guida alla piattaforma e opportunità (free webinar)
Tumblr - guida alla piattaforma e opportunità (free webinar)
 
Taiwan2009
Taiwan2009Taiwan2009
Taiwan2009
 
#fotocasaResponde: ¿Cómo reclamar la devolución de las cláusulas suelo?
#fotocasaResponde: ¿Cómo reclamar la devolución de las cláusulas suelo?#fotocasaResponde: ¿Cómo reclamar la devolución de las cláusulas suelo?
#fotocasaResponde: ¿Cómo reclamar la devolución de las cláusulas suelo?
 
FNPW and Preserving Planet Earth
FNPW and Preserving Planet EarthFNPW and Preserving Planet Earth
FNPW and Preserving Planet Earth
 

Similar to Android for Java Developers at OSCON 2010

Google Io Introduction To Android
Google Io Introduction To AndroidGoogle Io Introduction To Android
Google Io Introduction To AndroidBhavya Siddappa
 
Inside Android's Dalvik VM - NEJUG Nov 2011
Inside Android's Dalvik VM - NEJUG Nov 2011Inside Android's Dalvik VM - NEJUG Nov 2011
Inside Android's Dalvik VM - NEJUG Nov 2011Doug Hawkins
 
Google Android Naver 1212
Google Android Naver 1212Google Android Naver 1212
Google Android Naver 1212Yoojoo Jang
 
Introduction to Android platform
Introduction to Android platformIntroduction to Android platform
Introduction to Android platformmaamir farooq
 
Android application development
Android application developmentAndroid application development
Android application developmentLinh Vi Tường
 
Deep Dive Into Android Security
Deep Dive Into Android SecurityDeep Dive Into Android Security
Deep Dive Into Android SecurityMarakana Inc.
 
Android. behind the scenes_programatica 2012
Android. behind the scenes_programatica 2012Android. behind the scenes_programatica 2012
Android. behind the scenes_programatica 2012Agora Group
 
2011 android
2011 android2011 android
2011 androidvpedapolu
 
Windows Phone 7.5 와 Windows 8 메트로 스타일 앱 개발
Windows Phone 7.5  와 Windows 8 메트로 스타일 앱 개발Windows Phone 7.5  와 Windows 8 메트로 스타일 앱 개발
Windows Phone 7.5 와 Windows 8 메트로 스타일 앱 개발Seo Jinho
 
Lecture slides introduction_introduction
Lecture slides introduction_introductionLecture slides introduction_introduction
Lecture slides introduction_introductionBadr Benali
 
Multithreading in Android
Multithreading in AndroidMultithreading in Android
Multithreading in Androidcoolmirza143
 
Soa204 Kawasaki Final
Soa204 Kawasaki FinalSoa204 Kawasaki Final
Soa204 Kawasaki FinalAnush Kumar
 
실전 윈도우폰 망고 앱 디자인 & 개발 III(최종)
실전 윈도우폰 망고 앱 디자인 & 개발 III(최종)실전 윈도우폰 망고 앱 디자인 & 개발 III(최종)
실전 윈도우폰 망고 앱 디자인 & 개발 III(최종)mosaicnet
 
Cross Platform Mobile Apps with APIs from Qcon San Francisco
Cross Platform Mobile Apps with APIs from Qcon San FranciscoCross Platform Mobile Apps with APIs from Qcon San Francisco
Cross Platform Mobile Apps with APIs from Qcon San FranciscoCA API Management
 
Microsoft and Open Source Interoperability
Microsoft and Open Source InteroperabilityMicrosoft and Open Source Interoperability
Microsoft and Open Source Interoperabilityguest82d216
 
Silverlight abhinav - slideshare
Silverlight   abhinav - slideshareSilverlight   abhinav - slideshare
Silverlight abhinav - slideshareabhinav4133
 
Android Anatomy google io 2008
Android Anatomy google io 2008Android Anatomy google io 2008
Android Anatomy google io 2008Trinh Duy Hung
 

Similar to Android for Java Developers at OSCON 2010 (20)

Google Io Introduction To Android
Google Io Introduction To AndroidGoogle Io Introduction To Android
Google Io Introduction To Android
 
Android and Intel Inside
Android and Intel InsideAndroid and Intel Inside
Android and Intel Inside
 
Inside Android's Dalvik VM - NEJUG Nov 2011
Inside Android's Dalvik VM - NEJUG Nov 2011Inside Android's Dalvik VM - NEJUG Nov 2011
Inside Android's Dalvik VM - NEJUG Nov 2011
 
Google Android Naver 1212
Google Android Naver 1212Google Android Naver 1212
Google Android Naver 1212
 
Introduction to Android platform
Introduction to Android platformIntroduction to Android platform
Introduction to Android platform
 
Android application development
Android application developmentAndroid application development
Android application development
 
Deep Dive Into Android Security
Deep Dive Into Android SecurityDeep Dive Into Android Security
Deep Dive Into Android Security
 
Android. behind the scenes_programatica 2012
Android. behind the scenes_programatica 2012Android. behind the scenes_programatica 2012
Android. behind the scenes_programatica 2012
 
2011 android
2011 android2011 android
2011 android
 
Windows Phone 7.5 와 Windows 8 메트로 스타일 앱 개발
Windows Phone 7.5  와 Windows 8 메트로 스타일 앱 개발Windows Phone 7.5  와 Windows 8 메트로 스타일 앱 개발
Windows Phone 7.5 와 Windows 8 메트로 스타일 앱 개발
 
Lecture slides introduction_introduction
Lecture slides introduction_introductionLecture slides introduction_introduction
Lecture slides introduction_introduction
 
Multithreading in Android
Multithreading in AndroidMultithreading in Android
Multithreading in Android
 
Soa204 Kawasaki Final
Soa204 Kawasaki FinalSoa204 Kawasaki Final
Soa204 Kawasaki Final
 
실전 윈도우폰 망고 앱 디자인 & 개발 III(최종)
실전 윈도우폰 망고 앱 디자인 & 개발 III(최종)실전 윈도우폰 망고 앱 디자인 & 개발 III(최종)
실전 윈도우폰 망고 앱 디자인 & 개발 III(최종)
 
Cross Platform Mobile Apps with APIs from Qcon San Francisco
Cross Platform Mobile Apps with APIs from Qcon San FranciscoCross Platform Mobile Apps with APIs from Qcon San Francisco
Cross Platform Mobile Apps with APIs from Qcon San Francisco
 
Microsoft and Open Source Interoperability
Microsoft and Open Source InteroperabilityMicrosoft and Open Source Interoperability
Microsoft and Open Source Interoperability
 
Deep Dive into WinRT
Deep Dive into WinRTDeep Dive into WinRT
Deep Dive into WinRT
 
Silverlight abhinav - slideshare
Silverlight   abhinav - slideshareSilverlight   abhinav - slideshare
Silverlight abhinav - slideshare
 
Android Anatomy google io 2008
Android Anatomy google io 2008Android Anatomy google io 2008
Android Anatomy google io 2008
 
air
airair
air
 

More from Marko Gargenta

LTE: Building New Killer Apps
LTE: Building New Killer AppsLTE: Building New Killer Apps
LTE: Building New Killer AppsMarko Gargenta
 
Marakana Android User Interface
Marakana Android User InterfaceMarakana Android User Interface
Marakana Android User InterfaceMarko Gargenta
 
Marakana android-java developers
Marakana android-java developersMarakana android-java developers
Marakana android-java developersMarko Gargenta
 
Why Python by Marilyn Davis, Marakana
Why Python by Marilyn Davis, MarakanaWhy Python by Marilyn Davis, Marakana
Why Python by Marilyn Davis, MarakanaMarko Gargenta
 
Jens Østergaard on Why Scrum Is So Hard
Jens Østergaard on Why Scrum Is So HardJens Østergaard on Why Scrum Is So Hard
Jens Østergaard on Why Scrum Is So HardMarko Gargenta
 
Jens Østergaard on Why Scrum Is So Hard
Jens Østergaard on Why Scrum Is So HardJens Østergaard on Why Scrum Is So Hard
Jens Østergaard on Why Scrum Is So HardMarko Gargenta
 

More from Marko Gargenta (8)

LTE: Building New Killer Apps
LTE: Building New Killer AppsLTE: Building New Killer Apps
LTE: Building New Killer Apps
 
Java Champion Wanted
Java Champion WantedJava Champion Wanted
Java Champion Wanted
 
Marakana Android User Interface
Marakana Android User InterfaceMarakana Android User Interface
Marakana Android User Interface
 
Marakana android-java developers
Marakana android-java developersMarakana android-java developers
Marakana android-java developers
 
Scrum Overview
Scrum OverviewScrum Overview
Scrum Overview
 
Why Python by Marilyn Davis, Marakana
Why Python by Marilyn Davis, MarakanaWhy Python by Marilyn Davis, Marakana
Why Python by Marilyn Davis, Marakana
 
Jens Østergaard on Why Scrum Is So Hard
Jens Østergaard on Why Scrum Is So HardJens Østergaard on Why Scrum Is So Hard
Jens Østergaard on Why Scrum Is So Hard
 
Jens Østergaard on Why Scrum Is So Hard
Jens Østergaard on Why Scrum Is So HardJens Østergaard on Why Scrum Is So Hard
Jens Østergaard on Why Scrum Is So Hard
 

Recently uploaded

Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 

Recently uploaded (20)

Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 

Android for Java Developers at OSCON 2010

  • 1. Android  for  Java   Developers   OSCON  2010   Marko  Gargenta   Marakana  
  • 2. About  Marko  Gargenta   Developed Android Bootcamp for Marakana. Trained over 1,000 developers on Android. Clients include Qualcomm, Sony-Ericsson, Motorola, Texas Instruments, Cisco, Sharp, DoD. Author of upcoming Learning Android by O’Reilly. Spoke at OSCON, ACM, IEEE, SDC. Organizes SFAndroid.org
  • 3. Agenda   •  The  Stack   •  Android  SDK   •  Hello  World!   •  Main  Building  Blocks   •  Android  User  Interface   •  OperaIng  System  Features   •  Debugging   •  Summary  
  • 6. Linux  Kernel   Android runs on Linux. Applications Home Contacts Phone Browser Other Linux provides as well as: Hardware abstraction layer Application Framework Memory management Activity Window Content View Process management Manager Manager Providers System Package Telephony Resource Location Notiication Networking Manager Manager Manager Manager Manager Libraries Users never see Linux sub system Surface Media SQLite Android Runtime Manager Framework Core Libs The adb shell command opens OpenGL FreeType WebKit Delvik Linux shell SGL SSL libc VM Display Camera Linux Kernel Flash Binder Driver Driver Driver Driver Keypad WiFi Audio Power Driver Driver Driver Mgmt
  • 7. NaIve  Libraries   Bionic, a super fast and small Applications license-friendly libc library Home Contacts Phone Browser Other optimized for embedded use Application Framework Surface Manager for composing Activity Window Content View window manager with off-screen Manager Manager Providers System buffering Package Telephony Resource Location Notiication Manager Manager Manager Manager Manager Libraries 2D and 3D graphics hardware Surface Media SQLite Android Runtime support or software simulation Manager Framework Core Libs OpenGL FreeType WebKit Delvik Media codecs offer support for SGL SSL libc VM major audio/video codecs Display Camera Linux Kernel Flash Binder Driver Driver SQLite database Driver Driver Keypad WiFi Audio Power Driver Driver Driver Mgmt WebKit library for fast HTML rendering
  • 8. Dalvik   Dalvik VM is Google’s implementation of Java VM Optimized for mobile devices Key Dalvik differences: - Register-based versus stack-based VM - Dalvik runs .dex files - More efficient and compact implementation - Different set of Java libraries than SDK
  • 9. ApplicaIon  Framework   The rich set of system services Applications wrapped in an intuitive Java API. Home Contacts Phone Browser Other This ecosystem that developers Application Framework can easily tap into is what makes Activity Window Content View writing apps for Android easy. Manager Manager Providers System Package Telephony Resource Location Notiication Manager Manager Manager Manager Manager Location, web, telephony, WiFi, Libraries Bluetooth, notifications, media, Surface Manager Media Framework SQLite Android Runtime camera, just to name a few. Core Libs OpenGL FreeType WebKit Delvik VM SGL SSL libc Display Camera Linux Kernel Flash Binder Driver Driver Driver Driver Keypad WiFi Audio Power Driver Driver Driver Mgmt
  • 10. ApplicaIons   Dalvik Executable + Resources = APK Must be signed (but debug key is okay for development) Many markets with different policies
  • 11. Android  and  Java   Android Java = Java SE – AWT/Swing + Android API
  • 12. Android  SDK  -­‐  What’s  in  the  box   SDK Tools Docs Platforms Data Skins Images Samples Add-ons Google
  • 14. Create  New  Project   Use the Eclipse tool to create a new Android project. Here are some key constructs: Project   Eclipse  construct   Target   minimum  to  run   App  name   whatever   Package   Java  package   AcIvity   Java  class  
  • 15. The  Manifest  File   <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.marakana" android:versionCode="1" android:versionName="1.0"> <application android:icon="@drawable/icon" android:label="@string/app_name"> <activity android:name=".HelloAndroid" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> <uses-sdk android:minSdkVersion="5" /> </manifest>
  • 16. The  Layout  Resource   <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/hello" /> </LinearLayout>
  • 17. The  Java  File   package com.marakana; import android.app.Activity; import android.os.Bundle; public class HelloAndroid extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); } }
  • 20. AcIviIes   Activity is to an Android Application application what a Main Activity Another Another Activity Activity web page is to a website. Sort of.
  • 21. AcIvity  Lifecycle   Starting Activities have a well- (1) onCreate() (2) onStart() (3) onRestoreInstanceState() defined lifecycle. The (4) onResume() Android OS manages your activity by Running changing its state. (3) onResume() (2) onStart() (1) onSaveInstanceState() (2) onPause() You fill in the blanks. (1) onRestart() onResume() (1) onSaveInstanceState() Stopped (2) onStop() Paused onDestroy() or <process killed> <process killed> Destroyed
  • 22. Intents   Intents represent Android Application an events or actions. Main Activity Intent Another Activity They are to Intent Android apps what hyperlinks are to Android Application websites. Sort of. Another Main Activity Intent Activity Intents can be implicit or explicit.
  • 23. Services   Services are code that runs in the background. They can be started and stopped. Services doesn’t have UI.
  • 24. Service  Lifecycle   Service also has a Starting lifecycle, but it’s (1) onCreate() much simpler than (2) onStart() activity’s. onStart() An activity typically Stopped Running starts and stops a service to do some onStop() work for it in the background, such as onDestroy() or play music, check for <process killed> Destroyed new tweets, etc.
  • 25. Content  Providers   Content Providers share Content content with applications Provider across application Content URI boundaries. insert() Examples of built-in update() Content Providers are: delete() Contacts, MediaStore, query() Settings and more.
  • 26. Broadcast  Receivers   An Intent-based publish-subscribe mechanism. Great for listening system events such as SMS messages.
  • 27. MyTwiVer  –  A  Real  World  App   Update list MyTwitter Preference Timeline Activity Timeline Activity Activity Receiver Read/write Notify of preferences new status Update ListView Read Prefs Prefs XML Timeline Updates Status via Adapter web service Updater Read Prefs Service Pull timeline from DB Insert Pull timeline updates updates via in DB web service Start at Twitter.com Timeline boot DB Boot Receiver
  • 29. Two  UI  Approaches   Procedural   Declara?ve   You  write  Java  code   You  write  XML  code   Similar  to  Swing  or  AWT   Similar  to  HTML  of  a  web  page   You can mix and match both styles. Declarative is preferred: easier and more tools
  • 30. XML-­‐Based  User  Interface   Use WYSIWYG tools to build powerful XML-based UI. Easily customize it from Java. Separate concerns.
  • 31. Dips  and  Sps   px  (pixel)   Dots  on  the  screen   in  (inches)   Size  as  measured  by  a  ruler   mm  (millimeters)   Size  as  measured  by  a  ruler   pt  (points)   1/72  of  an  inch   dp  (density-­‐independent  pixel)   Abstract  unit.  On  screen  with  160dpi,   1dp=1px   dip   synonym  for  dp  and  ocen  used  by  Google   sp   Similar  to  dp  but  also  scaled  by  users  font   size  preference  
  • 32. Views  and  Layouts   ViewGroup ViewGroup View View View View Layouts contain other Views, or other Layouts.
  • 33. Common  UI  Components   Android UI includes many common modern UI widgets, such as Buttons, Tabs, Progress Bars, Date and Time Pickers, etc.
  • 34. SelecIon  Components   Some UI widgets may be linked to zillion pieces of data. Examples are ListView and Spinners (pull-downs).
  • 35. Adapters   Adapter Data Source To make sure they run smoothly, Android uses Adapters to connect them to their data sources. A typical data source is an Array or a Database.
  • 36. Complex  Components   Certain high-level components are simply available just like Views. Adding a Map or a Video to your application is almost like adding a Button or a piece of text.
  • 38. Graphics  &  AnimaIon   Android has rich support for 2D graphics. You can draw & animate from XML. You can use OpenGL for 3D graphics.
  • 39. MulImedia   AudioPlayer lets you simply specify the audio resource and play it. VideoView is a View that you can drop anywhere in your activity, point to a video file and play it. XML: <VideoView android:id="@+id/video" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_gravity="center” /> Java: player = (VideoView) findViewById(R.id.video); player.setVideoPath("/sdcard/samplevideo.3gp"); player.start();
  • 41. Security   Each Android application Android Application runs inside its own Linux process. Linux Process Additionally, each application has its own sandbox file File system with its own set of Prefs DB System preferences and its own database. Other applications cannot access any of its data, unless it is explicitly shared.
  • 42. File  System   The file system has three main mount points. One for system, one for the apps, and one for whatever. Each app has its own sandbox easily accessible to it. No one else can access its data. The sandbox is in /data/data/com.marakana/ SDCard is expected to always be there. It’s a good place for large files, such as movies and music. Everyone can access it.
  • 43. Cloud  to  Device  Push   Big deal for many pull-based apps. Will make devices use less battery.
  • 44. Preferences   Your app can support complex preferences quite easily. You define your preferences in an XML file and the corresponding UI and data storage is done for free.
  • 45. SQLite  Database   Android ships with SQLite3 SQLite is Zero configuration Serverless Single database file Cross-Platform Compact Public Domain Database engine. May you do good and not evil May you find forgiveness for yourself and forgive others May you share freely, never taking more than you give.
  • 47. LogCat   The universal, most versatile way to track what is going on in your app. Can be viewed via command line or Eclipse. Logs can be generated both from SDK Java code, or low-level C code via Bionic libc extension.
  • 48. Debugger   Your standard debugger is included in SDK, with all the usual bells & whistles.
  • 49. TraceView   TraceView helps you profile you application and find bottlenecks. It shows execution of various calls through the entire stack. You can zoom into specific calls.
  • 50. Hierarchy  Viewer   Hierarchy Viewer helps you analyze your User Interface. Base UI tends to be the most “expensive” part of your application, this tool is very useful.
  • 51. Summary   Android is open and complete system for mobile development. It is based on Java and augmented with XML. Android is being adopted very quickly both by users, carriers, and manufacturers. It takes about 3-5 days of intensive training to learn Android application development for someone who has basic Java (or similar) experience. Marko Gargenta, Marakana.com marko@marakana.com +1-415-647-7000 Licensed under Creative Commons License (cc-by-nc-nd) – non-commercial. Please Share!