Yourstory Android Workshop

download Yourstory Android Workshop

of 42

  • date post

  • Category


  • view

  • download


Embed Size (px)



Transcript of Yourstory Android Workshop

  • Agenda Introduction Android Components overview Sample Application Android Software Stack Android Components detailed Activity, Service, Provider, Receiver
  • History of Android Android, Inc. 2003 Operating system fordigital cameras Google Acquisition 2005 Open Handset Alliance Nov 2007 Google, HTC,Sonyand Samsung QualcommandTexas Instruments HTC Dream - October 22, 2008
  • Android Application Components
  • Application Components Application components are the essential building blocks of an Android application.
  • Application components Activity Service Broadcast Receiver Content Provider
  • Application components
  • Activities An activity represents a single screen with a user interface Example of Activities in Email app Email List Compose Read
  • Activities
  • Services A service is a component that runs in the background A service does not provide a user interface. Example : Music Player, Downloader
  • Services
  • Content Provider Content provider Allows to share data with other apps
  • Content Provider
  • Content Provider
  • Broadcast Receiver Listener of System wide events. Examples SMS received , Wifi / Bluetooth connected Battery Low, Device Rebooted No UI Lightweight ( < 10 seconds )
  • Intents IntentsIntents Intents are messages across components. Like Hyperlinks on the web
  • Intents Support interaction between components e.g. Start a new Activity Broadcast messages Intents : request for action to be performed
  • 17 Types of Intents MyApp Activity1 Service1Intent ( myService.class ) OtherAppMyApp Activity1 Activity2 Explicit Intent Implicit IntentIntent ( ACTION ) Intents
  • Intents start new Activity Dial a number Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse(tel:97412345)); Launch a website Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(;
  • Intents start new Activity Launch another activity Intent i = new Intent(this, SecondActivity.class) startActivity(i)
  • Intent Filter Registers components as capable of receiving Intents Matches intents to the component (Activity , Service, Receivers) Declared mostly in AndroidManifest.xml
  • Functional Android App
  • Application Manifest File
  • XML Snippet
  • Preview
  • Layouts Linear Layout Relative Layout List View Grid View
  • Linear Layout
  • Linear Layout
  • Layouts Grid ViewList View
  • UI Widgets
  • Sample App Button myButton =(Button)findViewById(;
  • Sample App public void (View v) { // action } Add this in XML file android:onClick="myMethod"
  • Sample App Extend this to create SecondActivity invoked on clicking the button
  • Inside the APK Compiled Java source Libraries XML files for UI, strings Resources Images etc Android Manifest
  • Android Software Stack Kernel Libraries / Runtime Application Framework Applications
  • Android Software Stack
  • Linux kernel Android built on Linux 2.6 kernel Provides security, memory management, process management, network stack, and driver model Abstraction layer between hardware and the software stack
  • Libraries A set of C/C++ libraries exposed to developers through the application framework
  • Application Framework
  • Application Framework
  • Applications
  • Summary Android Components Android Sample Program Activity, Services, Broadcast Receiver Intents Android Stack
  • Contact