Introduction to Android™ Application Development: Android ...
1 introduction of android
description
Transcript of 1 introduction of android
![Page 1: 1 introduction of android](https://reader037.fdocuments.us/reader037/viewer/2022103114/554f797fb4c905d25b8b46b6/html5/thumbnails/1.jpg)
Introduction
![Page 2: 1 introduction of android](https://reader037.fdocuments.us/reader037/viewer/2022103114/554f797fb4c905d25b8b46b6/html5/thumbnails/2.jpg)
What is a Software? A collection of computer programs and related data that provide the
instructions for telling a computer what to do and how to do it making imaginary into reality.
![Page 3: 1 introduction of android](https://reader037.fdocuments.us/reader037/viewer/2022103114/554f797fb4c905d25b8b46b6/html5/thumbnails/3.jpg)
SMART PHONES
![Page 4: 1 introduction of android](https://reader037.fdocuments.us/reader037/viewer/2022103114/554f797fb4c905d25b8b46b6/html5/thumbnails/4.jpg)
Smartphone= PDA + Cell phone
Smartphone Features Keyboard Internet Access Ability to download app & run independently Personal Information Management Wi-Fi Support 3rd party app And many more…
![Page 6: 1 introduction of android](https://reader037.fdocuments.us/reader037/viewer/2022103114/554f797fb4c905d25b8b46b6/html5/thumbnails/6.jpg)
Software Stack Set of programs working together to produce a result.
It consists of
1. Operating System
2. Middleware
3. Key Applications
![Page 7: 1 introduction of android](https://reader037.fdocuments.us/reader037/viewer/2022103114/554f797fb4c905d25b8b46b6/html5/thumbnails/7.jpg)
Different OS available
Feature iOS Android Windows Mobile
BlackBerry OS
Symbian Bada
Company Apple
Open Handset Alliance(Google)
Microsoft RIMSymbian Foundation
Samsung
Current Version
4.3.3
4.0(Phones) 4.0(Tablets)
6.5.3 6.0.0 9.5 1.2
Programmed in
C, C++, Objective-C
C, C++, Java
C++ Java C++ C++
![Page 8: 1 introduction of android](https://reader037.fdocuments.us/reader037/viewer/2022103114/554f797fb4c905d25b8b46b6/html5/thumbnails/8.jpg)
What is Android?
Android is a software stack for mobile devices that includes an operating system, middleware and key applications.
![Page 9: 1 introduction of android](https://reader037.fdocuments.us/reader037/viewer/2022103114/554f797fb4c905d25b8b46b6/html5/thumbnails/9.jpg)
WHYANDROID? A simple and powerful SDK
No licensing, distribution, or development fees Development over many platform Linux, Mac OS, windows
Excellent documentation
For us: Development using Java . Job opportunity
![Page 10: 1 introduction of android](https://reader037.fdocuments.us/reader037/viewer/2022103114/554f797fb4c905d25b8b46b6/html5/thumbnails/10.jpg)
The Birth of Android Android Inc. founded in 2003
The key players at Android Inc. included Andy Rubin -co-founder of Danger .Inc
Rich Miner-co-founder of Wildfire Communications, Inc. Nick Sears - once VP at T-Mobile Chris White - headed design and interface development at Web TV
Android Inc. acquired by Google
Google acquired the startup company Android Inc. in 2005 to start the development of the Android Platform.
![Page 11: 1 introduction of android](https://reader037.fdocuments.us/reader037/viewer/2022103114/554f797fb4c905d25b8b46b6/html5/thumbnails/11.jpg)
Introducing Android
A first joined project of the Open Handset Alliance (OHA) First open, complete and free platform Software stack open-sourced.
A generous development environment A SDK is available to build ,compile, test and debug user applications. Applications are developed using Java programming language No difference between the built-in applications and the user ones
![Page 12: 1 introduction of android](https://reader037.fdocuments.us/reader037/viewer/2022103114/554f797fb4c905d25b8b46b6/html5/thumbnails/12.jpg)
What is Open Handset Alliance? •“… Open Handset Alliance™, a group of 85 technology and mobile
firms have come together to develop open standards for mobile devices.
Google, HTC, Sony, Dell, Intel, Motorola, Qualcomm, Samsung, LG, T-
Mobile.....etc.
Announcement of the formation of the OHA was on 5 November 2007.
![Page 13: 1 introduction of android](https://reader037.fdocuments.us/reader037/viewer/2022103114/554f797fb4c905d25b8b46b6/html5/thumbnails/13.jpg)
First Mobile An early look of the SDK was released to developers on 12 November
2007.
The first commercially available Android phone was the T-Mobile G1 (HTC Dream). In August 2008,and became available on 22 October.
![Page 14: 1 introduction of android](https://reader037.fdocuments.us/reader037/viewer/2022103114/554f797fb4c905d25b8b46b6/html5/thumbnails/14.jpg)
Phones
Motorola Droid (X)
Huawei-IDEOS-X5 Samsung Galaxy
Nexus-S
sony-ericssonexperia-x10
HTC-Wildfire
![Page 15: 1 introduction of android](https://reader037.fdocuments.us/reader037/viewer/2022103114/554f797fb4c905d25b8b46b6/html5/thumbnails/15.jpg)
Tablets
Velocity Micro Cruz Gome FlyTouch Acer beTouch
Dawa D7
Cisco Android Tablet
Samsung Galaxy [email protected]
![Page 16: 1 introduction of android](https://reader037.fdocuments.us/reader037/viewer/2022103114/554f797fb4c905d25b8b46b6/html5/thumbnails/16.jpg)
Features 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
![Page 17: 1 introduction of android](https://reader037.fdocuments.us/reader037/viewer/2022103114/554f797fb4c905d25b8b46b6/html5/thumbnails/17.jpg)
What you need: Operating System:
Windows XP: (32-bit), Vista (32/64-bit), or Windows 7 (32/ 64-bit) Mac OS X : 10.5.8 or later (x86 only)
Linux : Ubuntu Linux, version 8.04 or later is required.
JDK >= 5
Android SDK
Eclipse + Android Development Tools plug-in
![Page 19: 1 introduction of android](https://reader037.fdocuments.us/reader037/viewer/2022103114/554f797fb4c905d25b8b46b6/html5/thumbnails/19.jpg)
Installation - Android SDKInstallation - Android SDK
Download the Android SDK from:
http://developer.android.com/sdk/
Unpack the compressed file into a location you prefer.
![Page 21: 1 introduction of android](https://reader037.fdocuments.us/reader037/viewer/2022103114/554f797fb4c905d25b8b46b6/html5/thumbnails/21.jpg)
To create an AVD in Eclipse:
1. Select Window > Android SDK and AVD Manager.The Android SDK and AVD Manager displays.
2. Make sure the entry for Virtual Devices is selected and click New.
The Create new AVD window displays.
3. Enter a Name for the AVD.
4. Select Android APIs (API level 8) as the Target.5. Click Create AVD.6. Close the Android SDK and AVD Manager.
![Page 22: 1 introduction of android](https://reader037.fdocuments.us/reader037/viewer/2022103114/554f797fb4c905d25b8b46b6/html5/thumbnails/22.jpg)
To create the project in Eclipse:
1. Select File > New > Project.2. Select Android Project in the Android folder and click Next.3. Enter Project Name.4. Select APIs (Platform 2.2) as the Build Target.5. Enter the Application name.6. Enter com.android as the Package name.7. Enter the Activity name.8. Click Finish.
![Page 25: 1 introduction of android](https://reader037.fdocuments.us/reader037/viewer/2022103114/554f797fb4c905d25b8b46b6/html5/thumbnails/25.jpg)
Every application must have an AndroidManifest.xml file (with precisely that name) in its root directory.
The manifest presents essential information about the application to the Android system, information the system must have before it can run any of the application's code.
Android Manifest xml File
![Page 26: 1 introduction of android](https://reader037.fdocuments.us/reader037/viewer/2022103114/554f797fb4c905d25b8b46b6/html5/thumbnails/26.jpg)
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="matos.currencyconvereter" android:versionCode="1" android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".Currency1" android:label="@string/app_name">
<intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter>
</activity> </application>
<uses-sdkandroid:minSdkVersion="3" /> </manifest>
![Page 28: 1 introduction of android](https://reader037.fdocuments.us/reader037/viewer/2022103114/554f797fb4c905d25b8b46b6/html5/thumbnails/28.jpg)
Android S/W Stack – Linux Kernel
This is the kernel on which android is based . This layer contains all the low level device drivers for the various hardware components of an android device.
Providing an abstraction layer between the H/W and the rest of the S/W stack letting the upper levels remain
unchanged despite changes in the underlying hardware.
![Page 29: 1 introduction of android](https://reader037.fdocuments.us/reader037/viewer/2022103114/554f797fb4c905d25b8b46b6/html5/thumbnails/29.jpg)
Android S/W Stack - Runtime
Core Libraries At the same layer as libraries set of core libraries that enable developers to write android Apps
using java Prog. Language.
Providing most of the functionality available in the core libraries of the Java language
APIs Data Structures Utilities File Access Network Access Graphics Etc
![Page 30: 1 introduction of android](https://reader037.fdocuments.us/reader037/viewer/2022103114/554f797fb4c905d25b8b46b6/html5/thumbnails/30.jpg)
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 so that a device can run multiple VMs efficiently.
Register-based virtual machine
![Page 31: 1 introduction of android](https://reader037.fdocuments.us/reader037/viewer/2022103114/554f797fb4c905d25b8b46b6/html5/thumbnails/31.jpg)
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 Low-level memory management
![Page 32: 1 introduction of android](https://reader037.fdocuments.us/reader037/viewer/2022103114/554f797fb4c905d25b8b46b6/html5/thumbnails/32.jpg)
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.
![Page 33: 1 introduction of android](https://reader037.fdocuments.us/reader037/viewer/2022103114/554f797fb4c905d25b8b46b6/html5/thumbnails/33.jpg)
Android S/W Stack – App Framework Features
Feature Role
View System
Used to build an application, including lists, grids, textboxes, buttons, and embedded web browser
Content Provider
Enabling applications to access data from other applications or to share their own data
Resource Manager
Providing access to non-code resources (localized string, graphics, and layout files)
Notification Manager
Enabling all applications to display customer alerts in the status bar
Activity Manager
Managing the lifecycle of applications and providing a common navigation backstack
![Page 34: 1 introduction of android](https://reader037.fdocuments.us/reader037/viewer/2022103114/554f797fb4c905d25b8b46b6/html5/thumbnails/34.jpg)
Android S/W Stack - Application
Android provides a set of core applications: Email Client SMS Program Calendar Maps Browser Contacts Etc
All applications are written using the Java language.
![Page 36: 1 introduction of android](https://reader037.fdocuments.us/reader037/viewer/2022103114/554f797fb4c905d25b8b46b6/html5/thumbnails/36.jpg)
Activity lifecycle An activity has essentially three states: It is active or running when it is in the foreground of
the screen (at the top of the activity stack for the current task). This is the activity that is the focus for the user's actions.
![Page 37: 1 introduction of android](https://reader037.fdocuments.us/reader037/viewer/2022103114/554f797fb4c905d25b8b46b6/html5/thumbnails/37.jpg)
As an activity transitions from state to state, it is notified of the change by calls to the following protected methods:
void onCreate(Bundle savedInstanceState) void onStart() void onRestart() void onResume() void onPause() void onStop() void onDestroy()
![Page 38: 1 introduction of android](https://reader037.fdocuments.us/reader037/viewer/2022103114/554f797fb4c905d25b8b46b6/html5/thumbnails/38.jpg)
onCreate() : called when the activity is first created
onStart() :called when activity becomes visible to user
onResume() : called when activity start interacting with user.
onPause() : called when current activity is being paused and previous activity is being resumed.
onStop() : called when activity is longer visible to user.
![Page 39: 1 introduction of android](https://reader037.fdocuments.us/reader037/viewer/2022103114/554f797fb4c905d25b8b46b6/html5/thumbnails/39.jpg)
onDestroy(): called before activity is destroyed by the system.
onRestart() : called when activity has been stopped and restarting again.
![Page 41: 1 introduction of android](https://reader037.fdocuments.us/reader037/viewer/2022103114/554f797fb4c905d25b8b46b6/html5/thumbnails/41.jpg)
Layouts1. LinearLayout2. RelativeLayout3. TableLayout4. TabLayout5. FrameLayout6. GridLayout7. ListView
![Page 42: 1 introduction of android](https://reader037.fdocuments.us/reader037/viewer/2022103114/554f797fb4c905d25b8b46b6/html5/thumbnails/42.jpg)
Layouts: Frame Layout: all child views are pinned to the top left
corner of the screen
Linear Layout: each child view is added in a straight line (vertically or horizontally)
Table Layout: add views using a grid of rows and columns
Relative Layout : add views relative to the position of other views or to its parent.
![Page 43: 1 introduction of android](https://reader037.fdocuments.us/reader037/viewer/2022103114/554f797fb4c905d25b8b46b6/html5/thumbnails/43.jpg)
Absolute Layout : for each view you add, you specify the exact screen coordinate to display on the screen
Tab Layout : add different tab relative to each other
![Page 44: 1 introduction of android](https://reader037.fdocuments.us/reader037/viewer/2022103114/554f797fb4c905d25b8b46b6/html5/thumbnails/44.jpg)
Views TextView Button EditText Radio button CheckBox Spinner WebView ImageView GalleryView SurfaceView
![Page 45: 1 introduction of android](https://reader037.fdocuments.us/reader037/viewer/2022103114/554f797fb4c905d25b8b46b6/html5/thumbnails/45.jpg)
Intent
![Page 46: 1 introduction of android](https://reader037.fdocuments.us/reader037/viewer/2022103114/554f797fb4c905d25b8b46b6/html5/thumbnails/46.jpg)
Message passing between two or more then two components of android
Activity interact each other with the help of intent in android
Basically two type of intent available in android
Implicit Intent Explicit Intent
![Page 47: 1 introduction of android](https://reader037.fdocuments.us/reader037/viewer/2022103114/554f797fb4c905d25b8b46b6/html5/thumbnails/47.jpg)
Implicit Intent: Intent which is sent from one activity
to in built android activity
For ex1. Dialer2. Contacts3. Browser
![Page 55: 1 introduction of android](https://reader037.fdocuments.us/reader037/viewer/2022103114/554f797fb4c905d25b8b46b6/html5/thumbnails/55.jpg)
Dial: Intent i = new Intent(); i.setAction(android.content.Intent.ACTION_DIAL); i.setData(Uri.parse("tel:2121")); startActivity(i);
Call: Intent i = new Intent(); i.setAction(android.content.Intent.ACTION_CALL); i.setData(Uri.parse("tel:2121")); startActivity(i);
![Page 56: 1 introduction of android](https://reader037.fdocuments.us/reader037/viewer/2022103114/554f797fb4c905d25b8b46b6/html5/thumbnails/56.jpg)
Browser: Intent i = new Intent(); i.setAction(android.content.Intent.ACTION_VIEW); i.setData(Uri.parse("http://www.google.com")); startActivity(i);
Contacts: Intent i = new Intent(); i.setAction(android.content.Intent.ACTION_VIEW); i.setData(Uri.parse("content://contacts/people/")); startActivity(i);
![Page 57: 1 introduction of android](https://reader037.fdocuments.us/reader037/viewer/2022103114/554f797fb4c905d25b8b46b6/html5/thumbnails/57.jpg)
Call_Log: Intent i = new Intent(); i.setAction(Intent.ACTION_VIEW); i.setData(Uri.parse("content://call_log/calls/1")); startActivity(i);
Media: Intent i = new Intent();
i.setAction(android.content.Intent.ACTION_VIEW); i.setData(Uri.parse("content://media/external/images/media/1")); startActivity(i);
![Page 58: 1 introduction of android](https://reader037.fdocuments.us/reader037/viewer/2022103114/554f797fb4c905d25b8b46b6/html5/thumbnails/58.jpg)
Camera: Intent i = new Intent(); i.setAction(MediaStore.ACTION_IMAGE_CAPTURE); startActivity(i);
Pick :Intent i = new Intent();i.setAction(android.content.Intent.ACTION_PICK);i.setData(Uri.parse("content://contacts/people/"));startActivity(i);
![Page 59: 1 introduction of android](https://reader037.fdocuments.us/reader037/viewer/2022103114/554f797fb4c905d25b8b46b6/html5/thumbnails/59.jpg)
Explicit Intent: intent which is send to one activity to
another own activity
Second Activity must be registered in manifest.xml file
Intent i=new Intent(First.this,Second.class);startActivity(i);