Você está na página 1de 34

ANDROID Presentation

6/12/12

AGENDA

General Overview - ANDROID Features Of Android Prerequisites Android Architecture Anatomy of an Android Application Android Project Structure
Root Contents The magic R.java AndroidManifest.xml


6/12/12

Ways to Develop Mobile Application Creating a new Android Hello World Project

GENERAL OVERVIEW - ANDROID What is an Android? Android is a software stack for mobile devices that includes an operating system, middleware and key applications.

The OHA( Open Handset Alliance) released the Google Android is built on the open Linux Kernel. The open architecture based on Intents. It utilizes Dalvik virtual machine (DalvikVM). Which is a register based virtual machine difference to DalvikVM optimize memory and hardware resources in

Android SDK on November 12th, 2007.

JVM which are stack based.

6/12/12 a mobile

GENERAL OVERVIEW ANDROID VERSION

Gingerbread
Android 4.0+

Honeycomb
Android 3.0-3.2

Ice cream Sandwich


Android 4.0+

6/12/12

GENERAL OVERVIEW-Distribution of Devices

6/12/12

Features Of Android

A simple and powerful SDK No licensing, distribution, or development fees Development over many platform Linux, Mac OS, Excellent documentation Thriving developer community For us Java-based, easy to import 3rdparty Java library Funding (40+ G1 phones) Prize (amazonskindle) Job opportunity
6/12/12

windows

Features Of Android

Application framework enabling reuse and Dalvik virtual machine optimized for mobile devices Integrated browser based on the open source Optimized graphics powered by a custom 2D OpenGL ES

replacement of components

WebKit engine

graphics library; 3D graphics based on the SQLite for structured data storage

1.0 specification (hardware acceleration optional)

Media support for common audio, video, and still AAC, AMR, JPG,

image formats (MPEG4, H.264, MP3,


6/12/12 PNG, GIF)

Prerequisites

Java JDK 6. See http://developer.android.com/sdk/requirements.html

Eclipse 3.6. Android SDK, version 14 or later See http://developer.android.com/sdk/installing.html Android ADT (Android Development Tools) plug-in for Eclipse, See

version >=14 http://developer.android.com/sdk/eclipse-adt.html#installing

In order to run the application in the Emulator, you need to set Android Virtual Device (AVD) that targets.

up at least one

6/12/12

Prerequisites-Setup Android SDK

Download Android SDK and extract the zip file to an http://androidappdocs.appspot.com/sdk/index.html E.g.: extract to C:\ The SDK will be used by ADT in eclipse

arbitrary folder

6/12/12

Prerequisites-Setup Android SDK

6/12/12

Prerequisites-Setup ADT plug-in

Install Eclipse ADT plugin

Eclipse must be J2EE edition, 3.5 recommended Update site: https://dl-ssl.google.com/android/eclipse/ Install all the plugins in the repository Restart needed after installation

6/12/12

Configure ADT Plug-in Open eclipse Window->Preferences, select Android Setup the SDK location as the folder where you extracted the downloaded SDK zip file

6/12/12

Setup Emulators (AVD) After SDK APIs installation, click Virtual Devices Click new, there will be a dialog input a name choose a running target and a skin specify the SD card size

6/12/12

6/12/12

Android Architecture

6/12/12

Android S/W Stack - Application

Android provides a set of core applications:


Email Client SMS Program Calendar Maps Browser Contacts Etc 1616

6/12/12

Android S/W Stack App Framework

Enabling and simplifying the reuse of components


Developers have full access to the same framework APIs used by the core applications. Users are allowed to replace components.

6/12/12

1717

Android S/W Stack App Framework (Cont)


Features
Feature View System Content Provider Resource Manager Role Used to build an application, including lists, grids, text boxes, buttons, and embedded web browser Enabling applications to access data from other applications or to share their own data Providing access to non-code resources (localized strings, graphics, and layout files)

Notification Enabling all applications to display customer alerts in the Manager status bar Activity Manager Managing the lifecycle of applications and providing a common navigation backstack

6/12/12

1818

Android S/W Stack - Libraries

Android S/W Stack Libraries

Including

a set of C/C++ libraries used by components of the Android system to developers through the Android application framework

Exposed

6/12/12

1919

Android S/W Stack - Runtime

Core Libraries

Providing most of the functionality available in the core libraries of the Java language APIs
Data Structures Utilities File Access Network Access Graphics

6/12/12

Etc

2020

Android S/W Stack Runtime (Cont)

Dalvik Virtual Machine

Providing environment on which every Android application runs


Each Android application runs in its own process,

with its own instance of the Dalvik VM.


Dalvik has been written such that a device can

run multiple VMs efficiently.

Register-based virtual machine

6/12/12

2121

Android S/W Stack Runtime (Cont)

Android S/W Stack Runtime (Cont)

Dalvik Virtual Machine (Cont)

Executing the Dalvik Executable (.dex) format


.dex format is optimized for minimal memory

footprint.

Compilation

Relying on the Linux Kernel for:


Threading

6/12/12

Anatomy of an Android Application


There are four building blocks to an Android application: Activity Intent Receiver Service Content Provider Not every application needs to have all four, but your application will be written with some combination of these.

6/12/12

Activity

An activity is usually a single screen in your application. Each activity is implemented as a single class that extends the Activity base class. Most applications consist of multiple screens. E.g Text message send 1) write the message. 2)choose contact etc Each of these screens would be implemented as an activity. to another screen is accomplished by a

6/12/12 Moving

Intent

An Intent is a special Android class. Intent describe what an application wants done. Two most important parts of the intent 1) the action & 2)the data to act upon Typical values for action are MAIN (the front door of the application), VIEW, PICK, EDIT, etc new Intent(android.content.Intent.VIEW_ACTION, ContentURI.create("http://anddev.org"));

6/12/12

Intent Receiver

an IntentReceiver when you want code in your application to execute in reaction to an external event. for example, when the phone rings, or when the data network is available Your application does not have to be running for its intent receivers to be called. the system will start your application, if necessary. For call An intent receiver is triggered

6/12/12

Service

A Service is code that is long-lived and runs without a UI. E.g a media player playing songs from play list. An activity starts a service using Context.startService() to run in background. you can connect to a service (and start it if it's not already running) with the Context.bindService() method.

6/12/12

Content Provider

A content provider is a class that implements a standard set of methods . other applications store and retrieve the type of data with content provider is useful if you want your application's data to be shared with other applications.

6/12/12

Android Project Structure

6/12/12

The magic R.java

Is an auto-generated file indexing all the resources of your project as a sort of short-hand way to refer to resources you've included in your project

6/12/12

Create a New Android Project

Open File>New->Android project

Project name Target name name

Build

Application Package Create

Activity

6/12/12

3131

Run Hello World

Select HelloWorld Project, Run->Run as>Android Application ADT will start a proper AVD and run HelloWorld app on it

6/12/12

3232

6/12/12

THANK YOU

6/12/12

Você também pode gostar