SlideShare ist ein Scribd-Unternehmen logo
1 von 64
Downloaden Sie, um offline zu lesen
Android	
  
         for	
  Java	
  Developers	
  
                   Marko	
  Gargenta	
  
                   marakana.com	
  




© 2011
About	
  Marko	
  Gargenta	
  
     Developer of Android Bootcamp for Marakana.

     Instructor for 1,000s of developers on Android at
     Qualcomm, Cisco, Motorola, Texas Instruments, Sony-
     Ericsson, Sharp, NetGear, DoD and other great orgs.

     Author of Learning Android published by O’Reilly.

     Speaker at OSCON, ACM, IEEE, SDC, AnDevCon.

     Founder of SFAndroid.org




© 2011
Agenda	
  
     •    The	
  Stack	
  
     •    Hello	
  World!	
  
     •    Main	
  Building	
  Blocks	
  
     •    Designing	
  an	
  Android	
  App	
  
     •    Android	
  User	
  Interface	
  
     •    OperaEng	
  System	
  Features	
  
     •    Debugging	
  and	
  Tools	
  
     •    Summary	
  




© 2011
ANDROID	
  STACK	
  


© 2011
The	
  Stack	
  




© 2011
Linux	
  Kernel	
  
     Android runs on Linux.                                        Applications


                                         Home      Contacts          Phone             Browser              Other

     Linux provides:
         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




© 2011
NaEve	
  Libraries	
  
     Pieces borrowed from other                                           Applications


     open source projects:                      Home      Contacts          Phone             Browser              Other




     Bionic, a super fast and small                                   Application Framework

     license-friendly libc library optimized   Activity
                                               Manager
                                                               Window
                                                               Manager
                                                                                         Content
                                                                                        Providers
                                                                                                                   View
                                                                                                                  System

     for Android                               Package    Telephony         Resource           Location            Notiication
                                               Manager     Manager          Manager            Manager             Manager


     WebKit library for fast HTML                                           Libraries

     rendering                                 Surface
                                               Manager
                                                             Media
                                                           Framework
                                                                               SQLite                  Android Runtime

                                                                                                             Core Libs
                                               OpenGL      FreeType            WebKit
     OpenGL for graphics                                                                                      Delvik
                                                                                                               VM
                                                 SGL          SSL               libc


     Media codecs offer support for
     major audio/video codecs                   Display    Camera         Linux Kernel              Flash                Binder
                                                Driver      Driver                                  Driver               Driver

                                                Keypad      WiFi                                    Audio                Power
                                                 Driver     Driver                                  Driver               Mgmt

     SQLite database

     Much more…
© 2011
Dalvik	
  


     Dalvik VM is Android implementation of
     Java VM

     Dalvik is optimized for mobile devices:
         •  Battery consumption
         •  CPU capabilities

     Key Dalvik differences:
         •  Register-based versus stack-based VM
         •  Dalvik runs .dex files
         •  More efficient and compact implementation
         •  Different set of Java libraries than JDK


© 2011
ApplicaEon	
  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




© 2011
ApplicaEons	
  




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

© 2011
Android	
  and	
  Java	
  
         Android Java
              =
           Java SE
              –
         AWT/Swing
              +
         Android API




© 2011
HELLO	
  WORLD!	
  


© 2011
Android	
  SDK	
  -­‐	
  What’s	
  In	
  The	
  Box
                                                           	
  

     SDK

     Tools
     Docs
     Platforms
          Data
          Skins
          Images
          Samples
     Add-ons
          Google




© 2011
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	
  
     AcEvity	
          Java	
  class	
  




© 2011
Anatomy	
  
         of	
  An	
  App	
  

           Java Code
               +
         XML and Other
           Resources
               +
          Manifest File
               =
          Android App




© 2011
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>

© 2011
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>




© 2011
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);
       }
     }




© 2011
Running	
  on	
  Emulator
                                 	
  




             Emulator, not a simulator
© 2011
MAIN	
  BUILDING	
  BLOCKS	
  


© 2011
Yamba	
  Demo	
  


             Let’s see a real-world medium
            complexity Android app in action:

         Yamba: Yet Another Micro Blogging App




© 2011
AcEviEes
                               	
  
                             Android Application
     An Activity
     represents a screen         Main Activity
                                                   Another
                                                   Activity
                                                              Another
                                                              Activity
     or a window. Sort of.




© 2011
AcEvity	
  Lifecycle	
  
  Activities have a well-
  defined lifecycle. The
  Android OS manages
  your activity by
  changing its state.
  You fill in the blanks.




© 2011
Intents
                                	
  
  Intents represent
  events or actions.

  They are to
  Android apps what
  hyperlinks are to
  websites. Sort of.

  Intents can be
  implicit or explicit.


© 2011
Services
                               	
  
     Services are code that runs in the background. They
     can be started and stopped. Services doesn’t have
     UI.




© 2011
Service	
  Lifecycle	
  
     Service also has a lifecycle, but it’s much simpler than
     activity’s.

     An activity typically starts and stops a service to do some
     work for it in the background, such as play music, check for
     new tweets, etc.

     Services can be bound or unbound.




© 2011
Remote	
  Services
                          	
  




© 2011
Content	
  Providers
                                    	
  

     Content Providers share
     content with applications
     across application
     boundaries.
     Examples of built-in
     Content Providers are:
     Contacts, MediaStore,
     Settings and more.



© 2011
Content	
  Provider	
  Example	
  




© 2011
Broadcast	
  Receivers
                                         	
  




         An Intent-based publish-subscribe mechanism. Great for listening
         system events such as SMS messages.


© 2011
Architecture	
  of	
  An	
  App	
  
         An Android application is a collection of many different
         building blocks. They are loosely coupled and can be
         reconfigured by the developer easily, or at least that’s
         the intention.

         Let’s look at 7 stages of Yamba next.




© 2011
Yamba	
  Part	
  1	
  




© 2011
Yamba	
  Part	
  2	
  




© 2011
Yamba	
  Part	
  3	
  




© 2011
Yamba	
  Part	
  4	
  




© 2011
Yamba	
  Part	
  5	
  




© 2011
Yamba	
  Part	
  6	
  




© 2011
Yamba	
  Part	
  7	
  




© 2011
ANDROID	
  USER	
  INTERFACE	
  


© 2011
Two	
  UI	
  Approaches	
  
            Procedural	
                              DeclaraAve	
  

            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. Best practice:

         •  Start with XML and declare most of UI
         •  Switch to Java and implement the UI logic


© 2011
XML-­‐Based	
  User	
  Interface	
  




         Use WYSIWYG tools to build powerful XML-based UI.
         Easily customize it from Java. Separate concerns.
© 2011
Views	
  and	
  Layouts
                                     	
  




         Layouts contain widgets and other
         layouts forming a “composite” pattern.
© 2011
Linear	
  Layout
                        	
  

             One of the most commonly
             used layouts. It lays its
             children next to each other,
             either horizontally or vertically.




© 2011
RelaEve	
  Layout
                         	
  

              Children of relative layout are
              placed in relationship to each
              other. This layout is efficient.




© 2011
Table	
  Layout
                       	
  

             Table layout puts its children
             into table rows and columns.
             It is similar to an HTML table.




© 2011
Frame	
  Layout
                       	
  

             Frame layout places its
             children on top of each other,
             like a deck of cards. It is
             useful for widgets such as
             tabs or as a placeholder for
             views added
             programmatically.




© 2011
Common	
  UI	
  Components
                                     	
  

     Android UI includes many
     common modern UI
     widgets, such as Buttons,
     Tabs, Progress Bars, Date
     and Time Pickers, etc.




© 2011
SelecEon	
  Components
                                  	
  

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




© 2011
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.

© 2011
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.




© 2011
Menus	
  and	
  Dialogs
                               	
  




© 2011
Graphics	
  &	
  AnimaEon	
  

     Android has rich support for 2D graphics.
     You can draw & animate from XML.
     You can use OpenGL for 3D graphics.




© 2011
MulEmedia	
  
     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();
© 2011
OPERATING	
  SYSTEM	
  FEATURES	
  	
  


© 2011
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.




© 2011
Cloud	
  to	
  Device	
  Push	
  




         Big deal for many pull-based apps. Will make devices use less battery.
© 2011
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.




© 2011
SQLite	
  Database	
  
         Android ships with SQLite3

         SQLite is a

         •  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.

© 2011
DEBUGGING	
  	
  
         ANDROID	
  APPS	
  

© 2011
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.




© 2011
Debugger
                                         	
  




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

© 2011
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.


© 2011
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.




© 2011
Summary	
  
              Android is open and complete system for
              mobile development. It is based on Java
              and augmented with XML, with lower
              levels written in C/C++.

              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




© 2011

Weitere ähnliche Inhalte

Was ist angesagt?

An Introduction To Android
An Introduction To AndroidAn Introduction To Android
An Introduction To AndroidGoogleTecTalks
 
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 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.
 
2011 android
2011 android2011 android
2011 androidvpedapolu
 
Android Beyond The Phone
Android Beyond The PhoneAndroid Beyond The Phone
Android Beyond The PhoneMarko Gargenta
 
Slides bootcamp21
Slides bootcamp21Slides bootcamp21
Slides bootcamp21dxsaki
 
Android architecture
Android architectureAndroid architecture
Android architectureHari Krishna
 
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
 
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
 
Android unveiled (I)
Android unveiled (I)Android unveiled (I)
Android unveiled (I)denian00
 
Introduction To Android
Introduction To AndroidIntroduction To Android
Introduction To Androidma-polimi
 
Tacademy techclinic-2012-07-11
Tacademy techclinic-2012-07-11Tacademy techclinic-2012-07-11
Tacademy techclinic-2012-07-11영호 라
 
Droid con 2012 bangalore v2.0
Droid con 2012   bangalore v2.0Droid con 2012   bangalore v2.0
Droid con 2012 bangalore v2.0Premchander Rao
 
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
 
Meego의 현재와 미래(2)
Meego의 현재와 미래(2)Meego의 현재와 미래(2)
Meego의 현재와 미래(2)mosaicnet
 
Eclipse vs Netbean vs Railo
Eclipse vs Netbean vs RailoEclipse vs Netbean vs Railo
Eclipse vs Netbean vs RailoMohd Safian
 

Was ist angesagt? (20)

Android Internals
Android InternalsAndroid Internals
Android Internals
 
An Introduction To Android
An Introduction To AndroidAn Introduction To Android
An Introduction To Android
 
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 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
 
2011 android
2011 android2011 android
2011 android
 
Android Beyond The Phone
Android Beyond The PhoneAndroid Beyond The Phone
Android Beyond The Phone
 
Slides bootcamp21
Slides bootcamp21Slides bootcamp21
Slides bootcamp21
 
Android architecture
Android architectureAndroid architecture
Android architecture
 
Android : How Do I Code Thee?
Android : How Do I Code Thee?Android : How Do I Code Thee?
Android : How Do I Code Thee?
 
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
 
Android unveiled (I)
Android unveiled (I)Android unveiled (I)
Android unveiled (I)
 
Introduction To Android
Introduction To AndroidIntroduction To Android
Introduction To Android
 
Tacademy techclinic-2012-07-11
Tacademy techclinic-2012-07-11Tacademy techclinic-2012-07-11
Tacademy techclinic-2012-07-11
 
Android primer
Android primerAndroid primer
Android primer
 
Droid con 2012 bangalore v2.0
Droid con 2012   bangalore v2.0Droid con 2012   bangalore v2.0
Droid con 2012 bangalore v2.0
 
Systems Resource Management with NetIQ AppManager
Systems Resource Management with NetIQ AppManagerSystems Resource Management with NetIQ AppManager
Systems Resource Management with NetIQ AppManager
 
Introduction to android
Introduction to androidIntroduction to android
Introduction to android
 
Android Anatomy
Android  AnatomyAndroid  Anatomy
Android Anatomy
 
Meego의 현재와 미래(2)
Meego의 현재와 미래(2)Meego의 현재와 미래(2)
Meego의 현재와 미래(2)
 
Eclipse vs Netbean vs Railo
Eclipse vs Netbean vs RailoEclipse vs Netbean vs Railo
Eclipse vs Netbean vs Railo
 

Andere mochten auch

Modul oop with java application mauludin
Modul oop with java application   mauludinModul oop with java application   mauludin
Modul oop with java application mauludinMauludin Ahmad
 
The Game Of Life - Java‘s Siblings and Heirs are populating the Ecosystem
The Game Of Life - Java‘s Siblings and Heirs are populating  the EcosystemThe Game Of Life - Java‘s Siblings and Heirs are populating  the Ecosystem
The Game Of Life - Java‘s Siblings and Heirs are populating the Ecosystemjexp
 
KC Java Android Talk (March 2011)
KC Java Android Talk (March 2011)KC Java Android Talk (March 2011)
KC Java Android Talk (March 2011)osake
 
First Steps in Android
First Steps in AndroidFirst Steps in Android
First Steps in AndroidRich Helton
 
Introduction to Android Development
Introduction to Android DevelopmentIntroduction to Android Development
Introduction to Android DevelopmentProf. Erwin Globio
 
Google I/O 2013 報告会 Android Studio と Gradle
Google I/O 2013 報告会 Android Studio と GradleGoogle I/O 2013 報告会 Android Studio と Gradle
Google I/O 2013 報告会 Android Studio と GradleKeishin Yokomaku
 
Android CodeLab - Nearby Places: Google Maps + Google Places
Android CodeLab - Nearby Places: Google Maps + Google PlacesAndroid CodeLab - Nearby Places: Google Maps + Google Places
Android CodeLab - Nearby Places: Google Maps + Google PlacesJordan Silva
 
Bosch diesel bombas VE 2009_2010
Bosch diesel bombas VE 2009_2010Bosch diesel bombas VE 2009_2010
Bosch diesel bombas VE 2009_2010Marcelo Bento
 
Bosch catálogo diesel bombas ve 2006 http -_unidadeinjetora
Bosch catálogo diesel bombas ve 2006   http -_unidadeinjetoraBosch catálogo diesel bombas ve 2006   http -_unidadeinjetora
Bosch catálogo diesel bombas ve 2006 http -_unidadeinjetoraAdilson Amorim
 
Games and Java ME - Have fun and earn some money
Games and Java ME - Have fun and earn some moneyGames and Java ME - Have fun and earn some money
Games and Java ME - Have fun and earn some moneyMarcelo Quinta
 
sistemas de injeccao diesel
sistemas de injeccao dieselsistemas de injeccao diesel
sistemas de injeccao dieselPedro Romeiro
 
Logistics,warehouse,mrp,drp
Logistics,warehouse,mrp,drpLogistics,warehouse,mrp,drp
Logistics,warehouse,mrp,drpVipul Patil
 
Practical OOP In Java
Practical OOP In JavaPractical OOP In Java
Practical OOP In Javawiradikusuma
 
Java for android developers
Java for android developersJava for android developers
Java for android developersAly Abdelkareem
 
Programação Android - Básico
Programação Android - BásicoProgramação Android - Básico
Programação Android - BásicoHugoDalevedove
 

Andere mochten auch (20)

Modul oop with java application mauludin
Modul oop with java application   mauludinModul oop with java application   mauludin
Modul oop with java application mauludin
 
The Game Of Life - Java‘s Siblings and Heirs are populating the Ecosystem
The Game Of Life - Java‘s Siblings and Heirs are populating  the EcosystemThe Game Of Life - Java‘s Siblings and Heirs are populating  the Ecosystem
The Game Of Life - Java‘s Siblings and Heirs are populating the Ecosystem
 
KC Java Android Talk (March 2011)
KC Java Android Talk (March 2011)KC Java Android Talk (March 2011)
KC Java Android Talk (March 2011)
 
First Steps in Android
First Steps in AndroidFirst Steps in Android
First Steps in Android
 
GUI Programming with Java
GUI Programming with JavaGUI Programming with Java
GUI Programming with Java
 
Gu iintro(java)
Gu iintro(java)Gu iintro(java)
Gu iintro(java)
 
Introduction to Android Development
Introduction to Android DevelopmentIntroduction to Android Development
Introduction to Android Development
 
Java cheat sheet
Java cheat sheet Java cheat sheet
Java cheat sheet
 
Google I/O 2013 報告会 Android Studio と Gradle
Google I/O 2013 報告会 Android Studio と GradleGoogle I/O 2013 報告会 Android Studio と Gradle
Google I/O 2013 報告会 Android Studio と Gradle
 
Android CodeLab - Nearby Places: Google Maps + Google Places
Android CodeLab - Nearby Places: Google Maps + Google PlacesAndroid CodeLab - Nearby Places: Google Maps + Google Places
Android CodeLab - Nearby Places: Google Maps + Google Places
 
OOP in Java
OOP in JavaOOP in Java
OOP in Java
 
Bosch diesel bombas VE 2009_2010
Bosch diesel bombas VE 2009_2010Bosch diesel bombas VE 2009_2010
Bosch diesel bombas VE 2009_2010
 
Bosch catálogo diesel bombas ve 2006 http -_unidadeinjetora
Bosch catálogo diesel bombas ve 2006   http -_unidadeinjetoraBosch catálogo diesel bombas ve 2006   http -_unidadeinjetora
Bosch catálogo diesel bombas ve 2006 http -_unidadeinjetora
 
Games and Java ME - Have fun and earn some money
Games and Java ME - Have fun and earn some moneyGames and Java ME - Have fun and earn some money
Games and Java ME - Have fun and earn some money
 
sistemas de injeccao diesel
sistemas de injeccao dieselsistemas de injeccao diesel
sistemas de injeccao diesel
 
Logistics,warehouse,mrp,drp
Logistics,warehouse,mrp,drpLogistics,warehouse,mrp,drp
Logistics,warehouse,mrp,drp
 
Practical OOP In Java
Practical OOP In JavaPractical OOP In Java
Practical OOP In Java
 
java swing
java swingjava swing
java swing
 
Java for android developers
Java for android developersJava for android developers
Java for android developers
 
Programação Android - Básico
Programação Android - BásicoProgramação Android - Básico
Programação Android - Básico
 

Ähnlich wie Android for Java Developers

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
 
Android application development
Android application developmentAndroid application development
Android application developmentLinh Vi Tường
 
Webinar The App Lifecycle Platform
Webinar The App Lifecycle PlatformWebinar The App Lifecycle Platform
Webinar The App Lifecycle PlatformService2Media
 
Accelerate your PaaS to the Mobile World: Silicon Valley Code Camp 2012
Accelerate your PaaS to the Mobile World: Silicon Valley Code Camp 2012Accelerate your PaaS to the Mobile World: Silicon Valley Code Camp 2012
Accelerate your PaaS to the Mobile World: Silicon Valley Code Camp 2012CloudBees
 
Android. behind the scenes_programatica 2012
Android. behind the scenes_programatica 2012Android. behind the scenes_programatica 2012
Android. behind the scenes_programatica 2012Agora Group
 
Open Source on the Mainframe Mini-Summit 2019 - Feilong Overview
Open Source on the Mainframe Mini-Summit 2019 - Feilong OverviewOpen Source on the Mainframe Mini-Summit 2019 - Feilong Overview
Open Source on the Mainframe Mini-Summit 2019 - Feilong OverviewOpen Mainframe Project
 
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
 
Introduction to Android platform
Introduction to Android platformIntroduction to Android platform
Introduction to Android platformmaamir farooq
 
Flex Air Intro
Flex Air IntroFlex Air Intro
Flex Air IntroJUG Genova
 
Microsoft Silverlight 2
Microsoft Silverlight 2Microsoft Silverlight 2
Microsoft Silverlight 2David Chou
 
Soa204 Kawasaki Final
Soa204 Kawasaki FinalSoa204 Kawasaki Final
Soa204 Kawasaki FinalAnush Kumar
 
Silverlight abhinav - slideshare
Silverlight   abhinav - slideshareSilverlight   abhinav - slideshare
Silverlight abhinav - slideshareabhinav4133
 
Multithreading in Android
Multithreading in AndroidMultithreading in Android
Multithreading in Androidcoolmirza143
 
Flex For Java Architects Ledroff Breizh Jug V Blog Cc
Flex For Java Architects Ledroff Breizh Jug V Blog CcFlex For Java Architects Ledroff Breizh Jug V Blog Cc
Flex For Java Architects Ledroff Breizh Jug V Blog CcFrançois Le Droff
 
Google Android Naver 1212
Google Android Naver 1212Google Android Naver 1212
Google Android Naver 1212Yoojoo Jang
 

Ähnlich wie Android for Java Developers (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
 
Android application development
Android application developmentAndroid application development
Android application development
 
Webinar The App Lifecycle Platform
Webinar The App Lifecycle PlatformWebinar The App Lifecycle Platform
Webinar The App Lifecycle Platform
 
Accelerate your PaaS to the Mobile World: Silicon Valley Code Camp 2012
Accelerate your PaaS to the Mobile World: Silicon Valley Code Camp 2012Accelerate your PaaS to the Mobile World: Silicon Valley Code Camp 2012
Accelerate your PaaS to the Mobile World: Silicon Valley Code Camp 2012
 
Android. behind the scenes_programatica 2012
Android. behind the scenes_programatica 2012Android. behind the scenes_programatica 2012
Android. behind the scenes_programatica 2012
 
Improve Android System Component Performance
Improve Android System Component PerformanceImprove Android System Component Performance
Improve Android System Component Performance
 
Open Source on the Mainframe Mini-Summit 2019 - Feilong Overview
Open Source on the Mainframe Mini-Summit 2019 - Feilong OverviewOpen Source on the Mainframe Mini-Summit 2019 - Feilong Overview
Open Source on the Mainframe Mini-Summit 2019 - Feilong Overview
 
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
 
Introduction to Android platform
Introduction to Android platformIntroduction to Android platform
Introduction to Android platform
 
Crx 2.2 Deep-Dive
Crx 2.2 Deep-DiveCrx 2.2 Deep-Dive
Crx 2.2 Deep-Dive
 
Flex Air Intro
Flex Air IntroFlex Air Intro
Flex Air Intro
 
Microsoft Silverlight 2
Microsoft Silverlight 2Microsoft Silverlight 2
Microsoft Silverlight 2
 
Soa204 Kawasaki Final
Soa204 Kawasaki FinalSoa204 Kawasaki Final
Soa204 Kawasaki Final
 
Silverlight abhinav - slideshare
Silverlight   abhinav - slideshareSilverlight   abhinav - slideshare
Silverlight abhinav - slideshare
 
Multithreading in Android
Multithreading in AndroidMultithreading in Android
Multithreading in Android
 
Mono for android
Mono for androidMono for android
Mono for android
 
Flex For Java Architects Ledroff Breizh Jug V Blog Cc
Flex For Java Architects Ledroff Breizh Jug V Blog CcFlex For Java Architects Ledroff Breizh Jug V Blog Cc
Flex For Java Architects Ledroff Breizh Jug V Blog Cc
 
Google Android Naver 1212
Google Android Naver 1212Google Android Naver 1212
Google Android Naver 1212
 

Mehr von 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
 

Mehr von 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
 

Kürzlich hochgeladen

"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DaySri Ambati
 
"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
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
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
 
"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
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
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
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 

Kürzlich hochgeladen (20)

"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
 
"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...
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
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
 
"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
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
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
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 

Android for Java Developers

  • 1. Android   for  Java  Developers   Marko  Gargenta   marakana.com   © 2011
  • 2. About  Marko  Gargenta   Developer of Android Bootcamp for Marakana. Instructor for 1,000s of developers on Android at Qualcomm, Cisco, Motorola, Texas Instruments, Sony- Ericsson, Sharp, NetGear, DoD and other great orgs. Author of Learning Android published by O’Reilly. Speaker at OSCON, ACM, IEEE, SDC, AnDevCon. Founder of SFAndroid.org © 2011
  • 3. Agenda   •  The  Stack   •  Hello  World!   •  Main  Building  Blocks   •  Designing  an  Android  App   •  Android  User  Interface   •  OperaEng  System  Features   •  Debugging  and  Tools   •  Summary   © 2011
  • 6. Linux  Kernel   Android runs on Linux. Applications Home Contacts Phone Browser Other Linux provides: 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 © 2011
  • 7. NaEve  Libraries   Pieces borrowed from other Applications open source projects: Home Contacts Phone Browser Other Bionic, a super fast and small Application Framework license-friendly libc library optimized Activity Manager Window Manager Content Providers View System for Android Package Telephony Resource Location Notiication Manager Manager Manager Manager Manager WebKit library for fast HTML Libraries rendering Surface Manager Media Framework SQLite Android Runtime Core Libs OpenGL FreeType WebKit OpenGL for graphics Delvik VM SGL SSL libc Media codecs offer support for major audio/video codecs Display Camera Linux Kernel Flash Binder Driver Driver Driver Driver Keypad WiFi Audio Power Driver Driver Driver Mgmt SQLite database Much more… © 2011
  • 8. Dalvik   Dalvik VM is Android implementation of Java VM Dalvik is optimized for mobile devices: •  Battery consumption •  CPU capabilities Key Dalvik differences: •  Register-based versus stack-based VM •  Dalvik runs .dex files •  More efficient and compact implementation •  Different set of Java libraries than JDK © 2011
  • 9. ApplicaEon  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 © 2011
  • 10. ApplicaEons   Dalvik Executable + Resources = APK Must be signed (but debug key is okay for development) Many markets with different policies © 2011
  • 11. Android  and  Java   Android Java = Java SE – AWT/Swing + Android API © 2011
  • 13. Android  SDK  -­‐  What’s  In  The  Box   SDK Tools Docs Platforms Data Skins Images Samples Add-ons Google © 2011
  • 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   AcEvity   Java  class   © 2011
  • 15. Anatomy   of  An  App   Java Code + XML and Other Resources + Manifest File = Android App © 2011
  • 16. 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> © 2011
  • 17. 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> © 2011
  • 18. 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); } } © 2011
  • 19. Running  on  Emulator   Emulator, not a simulator © 2011
  • 21. Yamba  Demo   Let’s see a real-world medium complexity Android app in action: Yamba: Yet Another Micro Blogging App © 2011
  • 22. AcEviEes   Android Application An Activity represents a screen Main Activity Another Activity Another Activity or a window. Sort of. © 2011
  • 23. AcEvity  Lifecycle   Activities have a well- defined lifecycle. The Android OS manages your activity by changing its state. You fill in the blanks. © 2011
  • 24. Intents   Intents represent events or actions. They are to Android apps what hyperlinks are to websites. Sort of. Intents can be implicit or explicit. © 2011
  • 25. Services   Services are code that runs in the background. They can be started and stopped. Services doesn’t have UI. © 2011
  • 26. Service  Lifecycle   Service also has a lifecycle, but it’s much simpler than activity’s. An activity typically starts and stops a service to do some work for it in the background, such as play music, check for new tweets, etc. Services can be bound or unbound. © 2011
  • 27. Remote  Services   © 2011
  • 28. Content  Providers   Content Providers share content with applications across application boundaries. Examples of built-in Content Providers are: Contacts, MediaStore, Settings and more. © 2011
  • 30. Broadcast  Receivers   An Intent-based publish-subscribe mechanism. Great for listening system events such as SMS messages. © 2011
  • 31. Architecture  of  An  App   An Android application is a collection of many different building blocks. They are loosely coupled and can be reconfigured by the developer easily, or at least that’s the intention. Let’s look at 7 stages of Yamba next. © 2011
  • 32. Yamba  Part  1   © 2011
  • 33. Yamba  Part  2   © 2011
  • 34. Yamba  Part  3   © 2011
  • 35. Yamba  Part  4   © 2011
  • 36. Yamba  Part  5   © 2011
  • 37. Yamba  Part  6   © 2011
  • 38. Yamba  Part  7   © 2011
  • 40. Two  UI  Approaches   Procedural   DeclaraAve   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. Best practice: •  Start with XML and declare most of UI •  Switch to Java and implement the UI logic © 2011
  • 41. XML-­‐Based  User  Interface   Use WYSIWYG tools to build powerful XML-based UI. Easily customize it from Java. Separate concerns. © 2011
  • 42. Views  and  Layouts   Layouts contain widgets and other layouts forming a “composite” pattern. © 2011
  • 43. Linear  Layout   One of the most commonly used layouts. It lays its children next to each other, either horizontally or vertically. © 2011
  • 44. RelaEve  Layout   Children of relative layout are placed in relationship to each other. This layout is efficient. © 2011
  • 45. Table  Layout   Table layout puts its children into table rows and columns. It is similar to an HTML table. © 2011
  • 46. Frame  Layout   Frame layout places its children on top of each other, like a deck of cards. It is useful for widgets such as tabs or as a placeholder for views added programmatically. © 2011
  • 47. Common  UI  Components   Android UI includes many common modern UI widgets, such as Buttons, Tabs, Progress Bars, Date and Time Pickers, etc. © 2011
  • 48. SelecEon  Components   Some UI widgets may be linked to zillion pieces of data. Examples are ListView and Spinners (pull-downs). © 2011
  • 49. 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. © 2011
  • 50. 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. © 2011
  • 51. Menus  and  Dialogs   © 2011
  • 52. Graphics  &  AnimaEon   Android has rich support for 2D graphics. You can draw & animate from XML. You can use OpenGL for 3D graphics. © 2011
  • 53. MulEmedia   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(); © 2011
  • 55. 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. © 2011
  • 56. Cloud  to  Device  Push   Big deal for many pull-based apps. Will make devices use less battery. © 2011
  • 57. 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. © 2011
  • 58. SQLite  Database   Android ships with SQLite3 SQLite is a •  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. © 2011
  • 59. DEBUGGING     ANDROID  APPS   © 2011
  • 60. 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. © 2011
  • 61. Debugger   Your standard debugger is included in SDK, with all the usual bells & whistles. © 2011
  • 62. 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. © 2011
  • 63. 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. © 2011
  • 64. Summary   Android is open and complete system for mobile development. It is based on Java and augmented with XML, with lower levels written in C/C++. 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 © 2011