of 39 /39
Compiled by intellisense ITsys Pvt Ltd r Kalpesh Parikh, Director

Android primer

Embed Size (px)

DESCRIPTION

Basic Learning about Android

Citation preview

Page 1: Android primer

Compiled by intellisense ITsys Pvt Ltd

Dr Kalpesh Parikh, Director

Page 2: Android primer

Compiled by intellisense ITsys Pvt Ltd

Android is a software stack for mobile devices that includes an operating system, middleware and key applications

What is Android

Page 3: Android primer

Compiled by intellisense ITsys Pvt Ltd

Application framework enabling reuse and replacement of components

Dalvik virtual machine optimized for mobile devices

Integrated browser based on the open source WebKit engine

Optimized graphics powered by a custom 2D graphics library; 3D graphics based on the OpenGL ES 1.0 specification (hardware acceleration optional)

SQLite for structured data storage

Media support for common audio, video, and still image formats (MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, GIF)

GSM Telephony (hardware dependent)

Bluetooth, EDGE, 3G, and WiFi (hardware dependent)

Camera, GPS, compass, and accelerometer (hardware dependent)

Rich development environment including a device emulator, tools for debugging, memory and performance profiling, and a plugin for the Eclipse IDE

Android Features

Page 4: Android primer

Compiled by intellisense ITsys Pvt Ltd

Android OS-Architecture

Page 5: Android primer

Compiled by intellisense ITsys Pvt Ltd

Android will ship with a set of core applications including an email client, SMS program, calendar, maps, browser, contacts, and others. All applications are written using the Java programming language.

Applications

Page 6: Android primer

Compiled by intellisense ITsys Pvt Ltd

By providing an open development platform, Android offers developers the ability to build extremely rich and innovative applications. Developers are free to take advantage of the device hardware, access location information, run background services, set alarms, add notifications to the status bar, and much, much more.

Developers have full access to the same framework APIs used by the core applications. The application architecture is designed to simplify the reuse of components; any application can publish its capabilities and any other application may then make use of those capabilities (subject to security constraints enforced by the framework). This same mechanism allows components to be replaced by the user.

Underlying all applications is a set of services and systems, including: A rich and extensible set of Views that can be used to build an application, including lists, grids, text boxes, buttons, and even an embeddable web browser Content Providers that enable applications to access data from other applications (such as Contacts), or to share their own data A Resource Manager, providing access to non-code resources such as localized strings, graphics, and layout files A Notification Manager that enables all applications to display custom alerts in the status bar An Activity Manager that manages the lifecycle of applications and provides a common navigation backstack

Application Framework

Page 7: Android primer

Compiled by intellisense ITsys Pvt Ltd

System C library - a BSD-derived implementation of the standard C system library (libc), tuned for embedded Linux-based devices

Media Libraries - based on PacketVideo's OpenCORE; the libraries support playback and recording of many popular audio and video formats, as well as static image files, including MPEG4, H.264, MP3, AAC, AMR, JPG, and PNG

Surface Manager - manages access to the display subsystem and seamlessly composites 2D and 3D graphic layers from multiple applications

LibWebCore - a modern web browser engine which powers both the Android browser and an embeddable web view

SGL - the underlying 2D graphics engine

3D libraries - an implementation based on OpenGL ES 1.0 APIs; the libraries use either hardware 3D acceleration (where available) or the included, highly optimized 3D software rasterizer

FreeType - bitmap and vector font rendering

SQLite - a powerful and lightweight relational database engine available to all applications

Core Libraries

Page 8: Android primer

Compiled by intellisense ITsys Pvt Ltd

•Android includes a set of core libraries that provides most of the functionality available in the core libraries of the Java programming language.

•Every Android application runs in its own process, with its own instance of the Dalvik virtual machine.

•Dalvik has been written so that a device can run multiple VMs efficiently.

•The Dalvik VM executes files in the Dalvik Executable (.dex) format which is optimized for minimal memory footprint.

•The VM is register-based, and runs classes compiled by a Java language compiler that have been transformed into the .dex format by the included "dx" tool.

•The Dalvik VM relies on the Linux kernel for underlying functionality such as threading and low-level memory management.

•Linux KernelAndroid relies on Linux version 2.6 for core system services such as security, memory management, process management, network stack, and driver model. The kernel also acts as an abstraction layer between the hardware and the rest of the software stack.

Android Runtime

Page 9: Android primer

Compiled by intellisense ITsys Pvt Ltd

http://developer.android.com/guide/tutorials/hello-world.html

Process Life Cycle

Page 10: Android primer

Compiled by intellisense ITsys Pvt Ltd

BASIC Terminologies

.apk file Android application package file.

.dex file Compiled Android application code file.

Action A description of something that an Intent sender wants done. An action is a string value assigned to an Intent.

Activity A single screen in an application, with supporting Java code, derived from the Activity class. Most commonly, an activity is visibly represented by a full screen window that can receive and handle UI events and perform complex tasks, because of the Window it uses to render its window. Though an Activity is typically full screen, it can also be floating or transparent.

adb Android Debug Bridge

Page 11: Android primer

Compiled by intellisense ITsys Pvt Ltd

Application An Android application consists of one or more activities, services, listeners, and intent receivers.

Canvas A drawing surface that handles compositing of the actual bits against a Bitmap or Surface object.

Content Provider A data-abstraction layer that you can use to safely expose your application's data to other applications.

Dalvik The Android platform's virtual machine. The Dalvik VM is an interpreter-only virtual machine that executes files in the Dalvik Executable (.dex) format

DDMS Dalvik Debug Monitor Service

Dialog A floating window that that acts as a lightweight form.

BASIC Terminologies

Page 12: Android primer

Compiled by intellisense ITsys Pvt Ltd

Drawable A compiled visual resource that can be used as a background, title, or other part of the screen

Intent An message object that you can use to launch or communicate with other applications/activities asynchronously.

Intent Filter A filter object that an application declares in its manifest file, to tell the system what types of Intents each of its components is willing to accept and with what criteria.

Broadcast Receiver An application class that listens for Intents that are broadcast, rather than being sent to a single target application/activity.

Layout Resource An XML file that describes the layout of an Activity screen.

BASIC Terminologies

Page 13: Android primer

Compiled by intellisense ITsys Pvt Ltd

Manifest File An XML file that each application must define, to describe the application's package name, version, components (activities, intent filters, services), imported libraries, and describes the various activities, and so on. See The AndroidManifest.xml File for complete information.

OpenGL ES Android provides OpenGL ES libraries that you can use for fast, complex 3D images.

Resources Nonprogrammatic application components that are external to the compiled application code, but which can be loaded from application code using a well-known reference format.

Service An object of class Service that runs in the background (without any UI presence) to perform various persistent actions, such as playing music or monitoring network activity.

BASIC Terminologies

Page 14: Android primer

Compiled by intellisense ITsys Pvt Ltd

Surface A Surface holds a Canvas object for drawing, and provides various helper methods to draw layers and resize the surface.

SurfaceView A View object that wraps a Surface for drawing, and exposes methods to specify its size and format dynamically.

Theme A set of properties (text size, background color, and so on) bundled together to define various default display settings.

URIs in Android Android uses URI strings as the basis for requesting data in a content provider (such as to retrieve a list of contacts) and for requesting actions in an Intent (such as opening a Web page in a browser).

View A View is a base class for most layout components of an Activity or Dialog screen (text boxes, windows, and so on).

BASIC Terminologies

Page 15: Android primer

Compiled by intellisense ITsys Pvt Ltd

Viewgroup A container object that groups a set of child Views.

Widget : View subclasses that render form elements and other UI components, such as a text box or popup menu.

BASIC Terminologies

Page 16: Android primer

Compiled by intellisense ITsys Pvt Ltd

ANDROID Software Stack

Page 17: Android primer

Compiled by intellisense ITsys Pvt Ltd

ANDROID Programming Framework

Page 18: Android primer

Compiled by intellisense ITsys Pvt Ltd

Quick StartThe steps below provide an overview of how to get started with the Android SDK. For detailed instructions, start with the Installing the SDK guide. 1. Prepare your development computerRead the System Requirements document and make sure that your development computer meets the hardware and software requirements for the Android SDK. Install any additional software needed before downloading the Android SDK. In particular, you may need to install the JDK (version 5 or 6 required) and Eclipse (version 3.4 or 3.5, needed only if you want develop using the ADT Plugin).

2. Download and install the SDK starter packageSelect a starter package from the table at the top of this page and download it to your development computer. To install the SDK, simply unpack the starter package to a safe location and then add the location to your PATH.

Setting up Development Computer

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

Page 19: Android primer

Compiled by intellisense ITsys Pvt Ltd

3. Install the ADT Plugin for EclipseInstall the Android Development Tools (ADT) Plugin, restart Eclipse, and set the "Android" preferences in Eclipse to point to the SDK install location.

4. Add Android platforms and other components to your SDKUse the Android SDK and AVD Manager, included in the SDK starter package, to add one or more Android platforms (for example, Android 1.6 or Android 2.2) and other components to your SDK.

To launch the Android SDK and AVD Manager on Windows, execute SDK Setup.exe, at the root of the SDK directory. On Mac OS X or Linux, execute the android tool in the <sdk>/tools/ folder.

The Android NDK is a companion tool to the Android SDK that lets you build performance-critical portions of your apps in native code.

Setting up Development Computer

Page 20: Android primer

Compiled by intellisense ITsys Pvt Ltd

Eclipse IDE

Page 21: Android primer

Compiled by intellisense ITsys Pvt Ltd

Eclipse IDE – Project Files

Page 22: Android primer

Compiled by intellisense ITsys Pvt Ltd

Eclipse IDE : Android Phone emulator

Page 23: Android primer

Compiled by intellisense ITsys Pvt Ltd

“Hello Android” Project

Page 24: Android primer

Compiled by intellisense ITsys Pvt Ltd

Create New Project (1)

Page 25: Android primer

Compiled by intellisense ITsys Pvt Ltd

Create New Project (2)

Page 26: Android primer

Compiled by intellisense ITsys Pvt Ltd

Create New Project (3)

Page 27: Android primer

Compiled by intellisense ITsys Pvt Ltd

Create New Project (4)

Page 28: Android primer

Compiled by intellisense ITsys Pvt Ltd

Editing Java Source File

Page 29: Android primer

Compiled by intellisense ITsys Pvt Ltd

Editing Layout Resource File

Page 30: Android primer

Compiled by intellisense ITsys Pvt Ltd

Editing Values Resource File

Page 31: Android primer

Compiled by intellisense ITsys Pvt Ltd

Editing AndroidManifest.xml

Page 32: Android primer

Compiled by intellisense ITsys Pvt Ltd

Debugging Syntax Error

Page 33: Android primer

Compiled by intellisense ITsys Pvt Ltd

Running the Program (1)

Page 34: Android primer

Compiled by intellisense ITsys Pvt Ltd

Running the Program (2)

Page 35: Android primer

Compiled by intellisense ITsys Pvt Ltd

Program Execution Message on Console

Page 36: Android primer

Compiled by intellisense ITsys Pvt Ltd

Week 1 - Introduction to Android and Java (a) Installing Android(b) Creating Hello World(c) Running on Emulator (d) Introduction to Java Data types, Loops, Conditionals and Operators

Week 2 - Android Architecture and OOPS (a) Building Blocks of Android(b) Java Classes and Objects(c) Class Methods and Instances(d) Inheritance and Polymorphism in Java(e) Interface and Abstract class

Week 3 - Android UI and Advance Java (a) Using resources(b) Using themes(c) Debugging Android Code(d) Settings(e) Java I/O(e) Threads and Synchronization

Android Learning Schedule

Page 37: Android primer

Compiled by intellisense ITsys Pvt Ltd

Week 4 - Android Graphics and Multimedia (a) Basic Graphics(b) Input Handling(c) Playing Audio(d) Playing Video

Week 5 - Persistence in Android (a) Accessing Internal Files system(b) Acessing SD cards(c) Introduction to SQLite(d) Data Binding(e) Content Provider

Week 6 - Network Awareness (a) Accessing the Internet(b) Using Web services(c) Using Java and Java Script(d) Location Sensing

Android Learning Schedule

Page 38: Android primer

Compiled by intellisense ITsys Pvt Ltd

Week 7 - 3D graphics in OpenGL and other views (a) OpenGL Introduction(b) Using Threads and Models(c) Texture in OpenGL(d) Making a application in OpenGL(e) Other standard views in Android

Week 8 - Widgets and the way ahead (a) Android Widget Development(b) The Path Ahead for Android(c) Running Application on device(d) Android Market Some Do’s and Don'ts(e) Introduction to System programming in Android

Week 9 & Week 10 - Live Project (a) Design and Requirement analysis support(b) Implementation and QA support

Android Learning Schedule

Page 39: Android primer

Compiled by intellisense ITsys Pvt Ltd

Think TechknowlogicallyMSWH-new Generation ERP

Technology

KnowledgeLogic ownership

SolutionTechniqueTechknowlogical