You are on page 1of 49

01.

Introduction

Course Description

Introduction
mit Topaan umit.topacan@gmail.com

Course Resources
Books
Beginning Android 4 Application Development, 1 edition
Wei-Meng Lee; Wrox (March 6,2012)

Professional Android 4 Application Development, 3 edition;


Reto Meier; Wrox (May 1, 2012)

Web Sites
http://developer.android.com/index.html

Aim
The course covers both of the fundamental and advanced topics of Android programming using the Android SDK.

Activities and Intents


What Activities are
activity is a window that contains the user interface of your applications

Understanding Activity Life Cycle


from the moment an activity appears on the screen to the moment it is hidden, it goes through a number of stages

Understanding the concept of intents


intent enables different activities from different applications to work together.

Android UI - Layouts
Working with Layouts Managing screen orientation changes Applying styles and themes to activities

Android UI Input Controls


Input controls are the interactive components in your app's user interface. Working with controls
Basic views Picker views Image views List views (Adapters)

Action Bar
Adding the Action Bar Adding Action Items Styling the ActionBar

Menus
Defining and using menus
Options menu Context menu Popup menu

User Notifications
Working with
Toasts Notifications Dialogs Broadcast Receivers

Data Storage
Shared Preferences
Store private primitive data in key-value pairs.

Internal Storage
Store private data on the device memory.

External Storage
Store public data on the shared external storage.

SQLite Databases
Store structured data in a private database.

Network Connection
Store data on the web with your own network server.

Content Providers
Using content providers to store and share application data
Content Providers offer a generic interface your applications can use to share data with and consume data from other applications including many of the native data stores

Using the native content providers


contacts and calendar

Working with Background tasks


Creating a service that runs in the background
A service is an application in Android that runs in the background without needing to interact with the user

Understanding AsyncTasks Performing Long-Running Tasks in a Thread

Messaging and Networking


Sending SMS messages programmatically Connecting to Web using HTTP
URLConnection

Calling Web Services


How to use the HTTP protocol to talk to web servers so that you can download text and binary data How to parse XML and JSON

Location Based Services


Getting your location with location-based services Creating map objects with Map Views and Map Activities Creating and adding Overlay Items to maps

Media and Camera


Playing audio and video with the Media Player Taking pictures and controlling the camera

Mobile Development

Mobile vs Desktop
Mobile devices and desktop computers are very different
small screen vs big screen intermittent vs reliable connectivity low vs high bandwidth battery powered vs plugged in

Mobile devices as underpowered versions of 'real' computers ??

Mobile vs Desktop
Mobile devices are actually more powerful than desktops in many ways.
highly personal
always with us directly addressable

they have powerful sensors that can detect


Location movement acceleration orientation environmental conditions

Developing for Mobile and Embedded Devices


Compared to desktop or notebook computers, mobile devices have relatively:
Low processing power Limited RAM Limited permanent storage capacity Small screens High costs associated with data transfer Intermittent connectivity, slow data transfer rates Unreliable data connections Limited battery life

Native vs Web Applications


Native Applications
built specifically for a particular device and its operating system. downloaded from a web store and installed on the device. written in Java, Objective C, or some other programming language. major advantage over web appsthe ability to use device-specific hardware and software.

Native vs Web Applications


Web Applications
a web application formatted for smartphones and tablets, and accessed through the mobile devices web browser. Like a traditional web application, a mobile web app is built with three core technologies
HTML (defines static text and images) CSS (defines style and presentation) JavaScript (defines interactions )

Since web apps are browser-based, theyre intended to be platform and device independent, able to run on any web-enabled smartphone or tablet

Popular Mobile Platforms


Android iOS Windows Phone BlackBerry Bada

Worldwide Smartphone Sales to End Users by Operating System

Worldwide Smartphone Sales

Android

What is Android
Android is an ecosystem made up of a combination of three components:
free, open-source operating system for embedded devices An open-source development platform for creating applications Devices, particularly mobile phones, that run the Android operating system and the applications created for it

Android Operating System


Mobile operating system that is based on a modified version of Linux Developed by a startup of the same name, Android, Inc In 2005, Google purchased Android

Open Handset Alliance (OHA)


Established on 6 November 2007 led by Google with 34 members (84 now)
mobile device makers Mobile operators chip makers

Aim
to accelerate innovation in mobile offer consumers a richer, less expensive, and better mobile experience

Android is the flagship software of the alliance

OHA Members

Android API Versions


Version
1.0 1.1 1.5 1.6 2.0

API
1 2 3 4 5

Codename

Release Date
3 September 2008 9 February 2009

Cupcake Donut Eclair

27 April 2009 15 September 2009 26 October 2009

2.0.1
2.1 2.2 - 2.2.3 2.3 - 2.3.2 2.3.3-2.3.7

6
7 8 9 10

Eclair
Eclair Froyo Gingerbread Gingerbread

3 December 2009
12 January 2010 20 May 2010 6 December 2010[ 9 February 2011

Android API Versions


Version
3.0
3.1

API
11
12

Codename
Honeycomb
Honeycomb

Release Date
22 February 2011
10 May 2011

3.2
4.0 - 4.0.2 4.0.3 4.0.4 4.1 4.2

13
14 15 16 17

Honeycomb
Ice Cream Sand. Ice Cream Sand. Jelly Bean Jelly Bean

15 July 2011
19 October 2011 16 December 2011 9 July 2012 13 November 2012

4.3
4.4

18
19

Jelly Bean
KitKat

24 July 2013
31 October 2013

Platform Versions
Version
2.2 2.3.3 2.3.7 3.2 4.0.3 4.0.4 4.1.x 4.2.x 4.3 4.4

Codename
Froyo Gingerbread Honeycomb Ice Cream Sandwich
Jelly Bean

API
8 10 13 15 16 17 18 19

Distribution
1.3 % 20.0 % 0.1 % 16.1 % 35.5 % 16.3 % 8.9 % 1.8 %

Kit Kat

Introduction to Development Framework


Android applications
written using Java as the programming language executed by means of a custom VM called Dalvik, rather than a traditional Java VM.

Each Android application runs in a separate process within its own Dalvik instance

Android Architecture

Linux Karnel

contains all the low level device drivers for the various hardware components
process management memory management device management like camera, keypad, display

provides an abstraction layer between the hardware and the remainder of the stack

Libraries

Contain all the code that provides the main features of an Android OS.
SQLite library provides database support WebKit library provides functionalities for web browsing SSL libraries responsible for Internet security

Android Runtime

includes a set of core libraries that provides functions of Java programming language. includes the Dalvik virtual machine
which is a specialized virtual machine designed specifically for Android OS to run android applications

Application Framework

Provides many higher-level services to applications in the form of Java classes


Content Provider Location Manager Notificattion Manager

Application Layer

applications that you download and install from the Android Market applications that you write

Dalvik Virtual Machine

Tools
Java Development Kit (JDK) Android Software Development Kit (SDK)
The Android SDK provides you the API libraries and developer tools necessary to build, test, and debug apps for Android.

Eclipse Integrated Development Environment (IDE) Android Development Tools (ADT)

ADT Bundle
Includes
Eclipse + ADT plugin Android SDK Tools Android Platform-tools The latest Android platform The latest Android system image for the emulator

Download from
http://developer.android.com/sdk/index.html

Android Software Development Kit (SDK)


Package SDK Tools Description Contains tools for debugging and testing, plus other utilities that are required to develop an app. File Location <sdk>/tools/

SDK Platformtools
Documentati on SDK Platform

Contains platform-dependent tools for developing and debugging your application


An offline copy of the latest documentation for the Android platform APIs. There's one SDK Platform available for each version of Android. It includes an android.jar file with a fully compliant Android library. In order to build an Android app, you must specify an SDK platform as your build target.

<sdk>/platformtools/
<sdk>/docs/ <sdk>/platforms /<androidversion>/

Android Software Development Kit (SDK)


Package System Images Description Each platform version offers one or more different system images (such as for ARM and x86). The Android emulator requires a system image to operate. A copy of the Android platform source code that's useful for stepping through the code while debugging your app. File Location <sdk>/platforms /<androidversion>/ <sdk>/sources/

Sources for Android SDK

Samples for SDK

A collection of sample apps that demonstrate a variety of the platform APIs.

<sdk>/platforms /<androidversion>/sample s/

Android Support

A static library you can include in your app sources in <sdk>/extras/an order to use powerful APIs that aren't available in droid/support/ the standard platform.

SDK Manager

The Android Virtual Device Manager


The Android Virtual Device Manager is used to create and manage the virtual devices that will host instances of the Emulator. AVDs are used to simulate the software builds and hardware configurations available on different physical devices. This lets you test your application on a variety of hardware platforms without needing to buy a variety of phones.

How to create AVD

You might also like