SlideShare une entreprise Scribd logo
1  sur  19
Télécharger pour lire hors ligne
Multithreading in Android


         Ahsen Tahir
Talk Outline
 Android Overview
 Android Stack
 Android Development Tools
 Main Building Blocks (Activity Life Cycle)
 Threading in Android
 Multithreading via AsyncTask Class
 Multithreading via Handler -> MessagePassing &
  Post() method
Android Overview
Awesome Ingredients:
                                                   Semiconductor
 Open Source Platform                             Manufacturers
   Apache/MIT License
   Third party libraries rewritten

 Designed for Mobile Devices                         OHA
    Limited Memory, Battery & Speed
                                        Mobile                      Software
 Comprehensive platform               Operators                   Development




 Android is owned by Open Handset Alliance (OHA).
Android Stack Layers
    Linux Kernel        Dalvik Runtime
    Native Libraries    Application Framework
Android Stack Layers
Linux kernel layer
 Why linux kernel?
   Portability
   Security
   Features

 Linux kernel 2.6.39
 kernel enhancements
    Drivers, Pluggable modules, Power management, IPC
Android Stack Layers
Native Libraries
 Function Libraries
      Webkit, Media framework, SQLite
 Bionic Libs
      Optimized for embedded use: libc
 Native Servers
      Surface flinger(manager),Audio flinger
 Hardware Abstraction Libraries (HAL)
Android Stack Layers
Android RunTime
 Core Libraries                         Java Source    Java Source
      Mostly Java SE (No AWT & Swing)      Code           Code
      More features                          Java
                                            Compiler
                                                             Java
                                                           Compiler

 Dalvik VM                                              Java Byte
                                          Java Byte
      Low memory, slow cpu, no swap        Code           Code
       space                                                 Dex
                                                           Compiler



                                            Execution   Dalvik Byte
                                                           Code
                                                           Execution




                                          Java VM        Dalvik VM
Android Stack Layers
Application Framework
 Java Libraries Built for Android
 Services (Managers)
Android Development
Development requirements
 Android SDK
http://developer.android.com/sdk/index.html

 Eclipse IDE for Java Developers
http://www.eclipse.org/downloads/packages/release/helios/sr2

 Android Development Plugin
http://developer.android.com/sdk/eclipse-adt.html
Android Development
IDE & Tools
 Android SDK
   Class Library
   Emulator and System Images
   Documentation and Sample Code
   Developer Tools
       dx – Dalvik Cross-Assembler
       aapt – Android Asset Packaging Tool
       adb – Android Debug Bridge
       ddms – Dalvik Debug Monitor Service

 Eclipse IDE + ADT plugin
   UI creation easier, reduces development time
Android Development
Programming Languages
 Java
 C/C++ (Restricted official support)
     http://developer.android.com/sdk/ndk/index.html
Android Activity Life Cycle
 Activity -> GUI/Window on screen
 Activity Life Cycle
Threading in Android
 A Thread is a concurrent unit of execution.
 A thread has its own call stack for methods being
  invoked, their arguments and local variables.
 Each virtual machine instance has at least one main
  Thread running when it is started; typically, there
  are several others for housekeeping.
 The application might decide to launch additional
  Threads for specific.
Threading in Android
 Threads in the same VM interact and synchronize
  by the use of shared objects and monitors
  associated with these objects.
 There are basically two main ways of having a
  Thread execute application code.
      One is providing a new class that extends Thread and
       overriding its run() method.
      The other is providing a new Thread instance with a
       Runnable object during its creation.
 In both cases, the start() method must be called
  to actually execute the new Thread.
Threading in Android
 Threads share the process' resources but are able
  to execute independently.
 Applications responsibilities can be separated
      main thread runs UI, and
      slow tasks are sent to background threads.
 Particularly useful in the case of a single process
  that spawns multiple threads on top of a
  multiprocessor system. In this case real
  parallelism is achieved.
 Consequently, a multithreaded program operates
  faster on computer systems that have multiple
  CPUs.
Multithreading Via AsycTask
Using the AsyncTask Class
 AsyncTask enables proper and easy use of the UI thread.
 This class allows to perform background operations and
  publish results on the UI thread without having to
  manipulate threads and/or handlers.
 An asynchronous task is defined by a computation that runs
  on a background thread and whose result is published on the
  UI thread.
 An asynchronous task is defined
Multithreading in Android
Using the AsyncTask Class
Multithreading Via Handler
Handler allows you to send and process
 Message and Runnable objects associated
 with a thread's MessageQueue
 Each Handler instance is associated with a
 single thread and that thread's message
 queue
   (1) to schedule messages and runnables to be
    executed as some point in the future; and
   (2) to enqueue an action to be performed on a
    different thread than your own.
 Post(Runnable) & sendMessage(Message)
Thanks

Contenu connexe

Tendances

Introduction to android
Introduction to androidIntroduction to android
Introduction to androidzeelpatel0504
 
Android application development ppt
Android application development pptAndroid application development ppt
Android application development pptGautam Kumar
 
Web Application Introduction
Web Application  IntroductionWeb Application  Introduction
Web Application Introductionshaojung
 
Introduction to Android and Android Studio
Introduction to Android and Android StudioIntroduction to Android and Android Studio
Introduction to Android and Android StudioSuyash Srijan
 
Android SDK Tutorial | Edureka
Android SDK Tutorial | EdurekaAndroid SDK Tutorial | Edureka
Android SDK Tutorial | EdurekaEdureka!
 
Android Application Development Using Java
Android Application Development Using JavaAndroid Application Development Using Java
Android Application Development Using Javaamaankhan
 
Android Programming Basics
Android Programming BasicsAndroid Programming Basics
Android Programming BasicsEueung Mulyana
 
Development of Mobile Application -PPT
Development of Mobile Application -PPTDevelopment of Mobile Application -PPT
Development of Mobile Application -PPTDhivya T
 
Android - Thread, Handler and AsyncTask
Android - Thread, Handler and AsyncTaskAndroid - Thread, Handler and AsyncTask
Android - Thread, Handler and AsyncTaskHoang Ngo
 
Android Architecture
Android ArchitectureAndroid Architecture
Android Architecturedeepakshare
 
Android architecture
Android architectureAndroid architecture
Android architecturepoojapainter
 
Android graphics
Android graphicsAndroid graphics
Android graphicsKrazy Koder
 

Tendances (20)

Introduction to android
Introduction to androidIntroduction to android
Introduction to android
 
Android architecture
Android architectureAndroid architecture
Android architecture
 
Android application development ppt
Android application development pptAndroid application development ppt
Android application development ppt
 
Web Application Introduction
Web Application  IntroductionWeb Application  Introduction
Web Application Introduction
 
Introduction to Android and Android Studio
Introduction to Android and Android StudioIntroduction to Android and Android Studio
Introduction to Android and Android Studio
 
Android SDK Tutorial | Edureka
Android SDK Tutorial | EdurekaAndroid SDK Tutorial | Edureka
Android SDK Tutorial | Edureka
 
Servlets
ServletsServlets
Servlets
 
Android Application Development Using Java
Android Application Development Using JavaAndroid Application Development Using Java
Android Application Development Using Java
 
Introduction to .NET Framework
Introduction to .NET FrameworkIntroduction to .NET Framework
Introduction to .NET Framework
 
Android Programming Basics
Android Programming BasicsAndroid Programming Basics
Android Programming Basics
 
Development of Mobile Application -PPT
Development of Mobile Application -PPTDevelopment of Mobile Application -PPT
Development of Mobile Application -PPT
 
Android - Thread, Handler and AsyncTask
Android - Thread, Handler and AsyncTaskAndroid - Thread, Handler and AsyncTask
Android - Thread, Handler and AsyncTask
 
Android User Interface
Android User InterfaceAndroid User Interface
Android User Interface
 
Android studio
Android studioAndroid studio
Android studio
 
Android - Android Intent Types
Android - Android Intent TypesAndroid - Android Intent Types
Android - Android Intent Types
 
Linker and Loader
Linker and Loader Linker and Loader
Linker and Loader
 
Android Architecture
Android ArchitectureAndroid Architecture
Android Architecture
 
Android Layout.pptx
Android Layout.pptxAndroid Layout.pptx
Android Layout.pptx
 
Android architecture
Android architectureAndroid architecture
Android architecture
 
Android graphics
Android graphicsAndroid graphics
Android graphics
 

Similaire à Multithreading in Android

Similaire à Multithreading in Android (20)

Lecture slides introduction_introduction
Lecture slides introduction_introductionLecture slides introduction_introduction
Lecture slides introduction_introduction
 
Introduction to Android platform
Introduction to Android platformIntroduction to Android platform
Introduction to Android platform
 
Java
JavaJava
Java
 
JAVA AND ANDROID OS_PRESENTATION
JAVA AND ANDROID OS_PRESENTATIONJAVA AND ANDROID OS_PRESENTATION
JAVA AND ANDROID OS_PRESENTATION
 
01 02 - introduction - adroid stack
01  02 - introduction - adroid stack01  02 - introduction - adroid stack
01 02 - introduction - adroid stack
 
Android Handheld Systems
Android Handheld SystemsAndroid Handheld Systems
Android Handheld Systems
 
DevNation
DevNation DevNation
DevNation
 
Ii 1300-java essentials for android
Ii 1300-java essentials for androidIi 1300-java essentials for android
Ii 1300-java essentials for android
 
Android OS
Android OSAndroid OS
Android OS
 
Java Lecture 1
Java Lecture 1Java Lecture 1
Java Lecture 1
 
Introduction to the Android NDK
Introduction to the Android NDKIntroduction to the Android NDK
Introduction to the Android NDK
 
Javanotes ww8
Javanotes ww8Javanotes ww8
Javanotes ww8
 
Java notes
Java notesJava notes
Java notes
 
Java ms harsha
Java ms harshaJava ms harsha
Java ms harsha
 
Mobile Java
Mobile JavaMobile Java
Mobile Java
 
J2ee strutswithhibernate-140121221332-phpapp01
J2ee strutswithhibernate-140121221332-phpapp01J2ee strutswithhibernate-140121221332-phpapp01
J2ee strutswithhibernate-140121221332-phpapp01
 
Android Introduction
Android IntroductionAndroid Introduction
Android Introduction
 
Android development process- thorsignia
Android development process- thorsigniaAndroid development process- thorsignia
Android development process- thorsignia
 
FRAUD DETECTION IN ONLINE AUCTIONING
FRAUD DETECTION IN ONLINE AUCTIONINGFRAUD DETECTION IN ONLINE AUCTIONING
FRAUD DETECTION IN ONLINE AUCTIONING
 
Java & J2EE Struts with Hibernate Framework
Java & J2EE Struts with Hibernate FrameworkJava & J2EE Struts with Hibernate Framework
Java & J2EE Struts with Hibernate Framework
 

Plus de coolmirza143

Introduction Cell Processor
Introduction Cell ProcessorIntroduction Cell Processor
Introduction Cell Processorcoolmirza143
 
Cell processor lab
Cell processor labCell processor lab
Cell processor labcoolmirza143
 
Introduction Cell Processor
Introduction Cell ProcessorIntroduction Cell Processor
Introduction Cell Processorcoolmirza143
 
Map reduceoriginalpaper mandatoryreading
Map reduceoriginalpaper mandatoryreadingMap reduceoriginalpaper mandatoryreading
Map reduceoriginalpaper mandatoryreadingcoolmirza143
 
Distributed Computing & MapReduce
Distributed Computing & MapReduceDistributed Computing & MapReduce
Distributed Computing & MapReducecoolmirza143
 
Introduction to Real-Time Operating Systems
Introduction to Real-Time Operating SystemsIntroduction to Real-Time Operating Systems
Introduction to Real-Time Operating Systemscoolmirza143
 

Plus de coolmirza143 (8)

Introduction Cell Processor
Introduction Cell ProcessorIntroduction Cell Processor
Introduction Cell Processor
 
Cell processor lab
Cell processor labCell processor lab
Cell processor lab
 
Introduction Cell Processor
Introduction Cell ProcessorIntroduction Cell Processor
Introduction Cell Processor
 
Map reduceoriginalpaper mandatoryreading
Map reduceoriginalpaper mandatoryreadingMap reduceoriginalpaper mandatoryreading
Map reduceoriginalpaper mandatoryreading
 
Distributed Computing & MapReduce
Distributed Computing & MapReduceDistributed Computing & MapReduce
Distributed Computing & MapReduce
 
Cuda lab manual
Cuda lab manualCuda lab manual
Cuda lab manual
 
Introduction to Real-Time Operating Systems
Introduction to Real-Time Operating SystemsIntroduction to Real-Time Operating Systems
Introduction to Real-Time Operating Systems
 
Cuda 2011
Cuda 2011Cuda 2011
Cuda 2011
 

Dernier

AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusZilliz
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024The Digital Insurer
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 

Dernier (20)

AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 

Multithreading in Android

  • 2. Talk Outline  Android Overview  Android Stack  Android Development Tools  Main Building Blocks (Activity Life Cycle)  Threading in Android  Multithreading via AsyncTask Class  Multithreading via Handler -> MessagePassing & Post() method
  • 3. Android Overview Awesome Ingredients: Semiconductor  Open Source Platform Manufacturers  Apache/MIT License  Third party libraries rewritten  Designed for Mobile Devices OHA  Limited Memory, Battery & Speed Mobile Software  Comprehensive platform Operators Development Android is owned by Open Handset Alliance (OHA).
  • 4. Android Stack Layers  Linux Kernel  Dalvik Runtime  Native Libraries  Application Framework
  • 5. Android Stack Layers Linux kernel layer  Why linux kernel?  Portability  Security  Features  Linux kernel 2.6.39  kernel enhancements  Drivers, Pluggable modules, Power management, IPC
  • 6. Android Stack Layers Native Libraries  Function Libraries  Webkit, Media framework, SQLite  Bionic Libs  Optimized for embedded use: libc  Native Servers  Surface flinger(manager),Audio flinger  Hardware Abstraction Libraries (HAL)
  • 7. Android Stack Layers Android RunTime  Core Libraries Java Source Java Source  Mostly Java SE (No AWT & Swing) Code Code  More features Java Compiler Java Compiler  Dalvik VM Java Byte Java Byte  Low memory, slow cpu, no swap Code Code space Dex Compiler Execution Dalvik Byte Code Execution Java VM Dalvik VM
  • 8. Android Stack Layers Application Framework  Java Libraries Built for Android  Services (Managers)
  • 9. Android Development Development requirements  Android SDK http://developer.android.com/sdk/index.html  Eclipse IDE for Java Developers http://www.eclipse.org/downloads/packages/release/helios/sr2  Android Development Plugin http://developer.android.com/sdk/eclipse-adt.html
  • 10. Android Development IDE & Tools  Android SDK  Class Library  Emulator and System Images  Documentation and Sample Code  Developer Tools dx – Dalvik Cross-Assembler aapt – Android Asset Packaging Tool adb – Android Debug Bridge ddms – Dalvik Debug Monitor Service  Eclipse IDE + ADT plugin  UI creation easier, reduces development time
  • 11. Android Development Programming Languages  Java  C/C++ (Restricted official support)  http://developer.android.com/sdk/ndk/index.html
  • 12. Android Activity Life Cycle  Activity -> GUI/Window on screen  Activity Life Cycle
  • 13. Threading in Android  A Thread is a concurrent unit of execution.  A thread has its own call stack for methods being invoked, their arguments and local variables.  Each virtual machine instance has at least one main Thread running when it is started; typically, there are several others for housekeeping.  The application might decide to launch additional Threads for specific.
  • 14. Threading in Android  Threads in the same VM interact and synchronize by the use of shared objects and monitors associated with these objects.  There are basically two main ways of having a Thread execute application code.  One is providing a new class that extends Thread and overriding its run() method.  The other is providing a new Thread instance with a Runnable object during its creation.  In both cases, the start() method must be called to actually execute the new Thread.
  • 15. Threading in Android  Threads share the process' resources but are able to execute independently.  Applications responsibilities can be separated  main thread runs UI, and  slow tasks are sent to background threads.  Particularly useful in the case of a single process that spawns multiple threads on top of a multiprocessor system. In this case real parallelism is achieved.  Consequently, a multithreaded program operates faster on computer systems that have multiple CPUs.
  • 16. Multithreading Via AsycTask Using the AsyncTask Class  AsyncTask enables proper and easy use of the UI thread.  This class allows to perform background operations and publish results on the UI thread without having to manipulate threads and/or handlers.  An asynchronous task is defined by a computation that runs on a background thread and whose result is published on the UI thread.  An asynchronous task is defined
  • 17. Multithreading in Android Using the AsyncTask Class
  • 18. Multithreading Via Handler Handler allows you to send and process Message and Runnable objects associated with a thread's MessageQueue  Each Handler instance is associated with a single thread and that thread's message queue  (1) to schedule messages and runnables to be executed as some point in the future; and  (2) to enqueue an action to be performed on a different thread than your own.  Post(Runnable) & sendMessage(Message)