school updated

80
INTRO ABOUT OOPS,ANDROID AND ITS COMPONENTS

Upload: skumartarget

Post on 18-Jan-2017

102 views

Category:

Education


0 download

TRANSCRIPT

Page 1: School updated

INTRO ABOUT OOPS,ANDROID AND ITS COMPONENTS

Page 2: School updated

CONFIDENTIAL INFORMATIONThis document is confidential and proprietary information of Target Soft Systems. Confidential Information includes, but is not limited to, the following: Corporate, Employee and Infrastructure Information about Target Soft Systems.

Target Soft Systems implementation , Training methodology, cost, project management and quality processes. Any disclosure of Confidential Information to, or use of it by a third party (i.e., a party other than authorised , will be damaging to Target Soft Systems). Ownership of all Confidential Information, no matter in what media it resides, remains with Target Soft Systems( TSS ). Confidential Information in this document shall not be disclosed outside the buyer’s proposal evaluators and shall not be duplicated, used, or disclosed – in whole or in part – for any purpose other than to evaluate this proposal without specific written permission of an authorized representative of Target Soft Systems.

Page 3: School updated
Page 4: School updated
Page 5: School updated
Page 6: School updated
Page 7: School updated
Page 8: School updated
Page 9: School updated

REFRESHMENT OF OOPS » What is OOPS ?

» Object

» Class

» Abstraction

» Encapsulation

» Inheritance

» Polymorphism(Run Time & Compile Time)

Page 10: School updated

Object Oriented Programming System

Object Oriented Programming is a methodology to design a program using Classes and Objects.

It simplifies the software development and maintenance by providing some concepts:

> Object > Class> Inheritance> Polymorphism> Abstraction> Encapsulation

Page 11: School updated

OBJECTA runtime entity that has state and behavior is known as Object.

Object= data + method ,Object is an instance of a class.

An object has these characteristics:

State: represents the data of an Object.Behavior: represents the behavior of an Object.

Real time Example:Pen is an object. Its name is Reynolds, color is White etc,.Known as it state.It is used to write, so Writing is its behavior.

Page 12: School updated

CLASS

A Class is a group of objects that have common property. (or)

Collection of Objects. It is a Template or Blue Print from which objects are created.

Syntax to declare a Class: Class <class name> { data member; method; }

Page 13: School updated

Example for Class and Object: Class Company { String name = “Target Soft Systems”; int phoneno = “9382383393”; public static void main( string[] args) { Student s1 = new Company(); // object System.out.println(“Name is:” +s1.name); System.out.println(“Phone No:” +s1.phoneno); }

} Output: Name is: Target Soft Systems Phone No: 9382383393

Page 14: School updated

ABSTRACTION Abstraction is a process of hiding the implementation details and showing only functionality to the user. (OR)It highlights the essential things to the user and hides the non- essential things.

Real Time Example:Sending SMS: you just type the text and send the message you don’t know the internal processing about message delivery. Syntax to declare the abstract class: Abstract class < class- name> {

}

Page 15: School updated

ENCAPSULATION

Encapsulation is a process of wrapping code and Data together into a single unit.

We can calculate a fully encapsulated class by making all the data members of the class private now we can use setter and getter methods to set and get the data in it.

Page 16: School updated

INHERITANCEInheritance is a mechanism in which one object acquires and the properties and behaviors of parent class. A new class derived from old class.Syntax for Inheritance:

class subclass name extends super class name{

}extends is a key word is used to inherit one class for another class.On the basis of class, there can be three types of inheritance single, multilevel and Hierarchical. Multiple and Hybrid is supported through interface only. To reduce the complexity and simplify the language, multiple interfaces are not supported in Java.

Page 17: School updated

POLYMORPHISMIn general polymorphism is a particular thing behave differently in a different situation

Two types of Polymorphism: Compile time Polymorphism Run time PolymorphismCompile time Polymorphism Example: Method Overriding.Run time Polymorphism Example: Method Overloading.

Real time Example:Mobile Phone: It acts like a phone where you calling to someone. It acts like a camera whiles you taking a snap. It acts like a Music player whiles you hearing song from that.

Page 18: School updated

Compile Time Polymorphism

Method Overriding:Method having same name, same number of arguments and its data type.

Sum( int a, int b)Sum( int c, int d)Sum( float a, float b)Sum( float c, float d)

overriding method MUST have the same argument list (if not, it might be a case of overloading)

Page 19: School updated

Run time PolymorphismMethod overloading:Method having same name but difference in the number of arguments and its data type.

Example:Sum( int a, int b)Sum( int a, int b, int c)Sum( float a, float b)Sum( float a, float b, float c)

For example the entire method names are same but the main difference in the number of arguments and its data type.

Page 20: School updated

BASIC MODEL MOBILE PHONESSMART PHONES

LETTERS LANDLINE PHONE

Page 21: School updated

DIFFERENCE BETWEEN BASIC MOBILE & SMART MOBILE

BASIC MOBILE SMART MOBILE

A normal phone has the primary purpose of only calling and sending text messages

Smart phones offer a variety of features that allows advanced computing capability and connectivity.

Its not possible to install the mobile apps in basic phone

It is possible to install the mobile apps using smart phone

Basic phones are quite cheap Smart phones are costlier when comparing to basic phones.

Its not possible to use a memory card It is possible to use a memory card.

Page 22: School updated

WHY SMARTPHONE?• Smart phone plays a major role among the users.• The current generation of consumers are equipped with

smart phones that provide extensive applications to transact with.

• Besides making phone calls, nearly all smart phones today can natively provide directions through GPS, take pictures, play music and keep track of appointments and contacts.

• Through the installation of apps, the list of possible smart phone uses multiplies by tens of thousands and grows longer everyday.

Page 23: School updated

MOBILE USERS

Page 24: School updated

GROWTH OF MOBILE USERS

Page 25: School updated

MOBILE APPS

Page 26: School updated

ABOUT ANDROID

If you are interested in mobile app development, you need to learn android. Learning android app development and programming is important for professional programmers and amateurs alike, simply because there is a lot you can achieve through an android app of your own. According to a report by Google in September 2012, 500 million android activations have already taken place all over the world. The comScore mobiLens survey reported in January 2013 that there were 68 million Android users in US alone. 

Page 27: School updated

ANDROID HISTORY

•Android Inc was founded in Palo Alto of California, U.S. by Andy Rubin, Rich miner, Nick sears and Chris White in 2003. Later Android Inc. was acquired by Google in 2005.

•In 2005 Google purchased Android and took over its development work and also the development team.

•Google wanted Android to be open and free then most of the Android code was released under open source.

Page 28: School updated

VERSIONS OF ANDROIDPre-commercial release versions (2007–2008)

Android alpha

There were at least two internal releases inside Google and the OHAreleases code-named “Astra Boy", “Bender"

Android betaThe Android beta was released on 5 November 2007

The Software Development Kit (SDK) was released on 12th November 2007.

The 5th November date is popularly celebrated as “Android's Birthday”

Page 29: School updated

SDK• A software development kit that enables

developers to create applications for the Android platform. The Android SDK includes sample projects with source code, development tools, an emulator, and required libraries to build Android applications. Applications are written using the Java programming language and run on Dalvik, a custom virtual machine designed for embedded use which runs on top of a Linux kernel.

Page 30: School updated

VERSIONS OF ANDROID

 Android has seen numerous Updates which have incrementally improved the operating system, adding new features and fixing bugs in previous releases.

Each major release is named in alphabetical order after a dessert or sugary treat

For example

Version 1.5 Cupcake was followed by 1.6 Donut.

The latest released version is 4.4 Kit Kat

Page 31: School updated

CUPCAKE 1.5

On 30 April 2009, the Android 1.5 update was released.

This was the first release to officially use a codename based on a dessert item ("Cupcake")

» Added auto-rotation option.

» Copy and Paste feature added in the web browser.

» Increased speed and performance but not up to required level.

VERSIONS OF ANDROID

Page 32: School updated

DONUT 1.6

On 15 September 2009, the Android 1.6 SDK - Donut was released

» Voice search

» Search box

» Faster OS boot times

» Fast web browsing experience.

» Typing is quite slower.

VERSIONS OF ANDROID

Page 33: School updated

ECLAIR 2.0On 26 October 2009, the Android 2.0 SDK codenamed Eclair was released.

» Bluetooth 2.1 support.» Improved typing speed on virtual keyboard with smarter dictionary.» no Adobe flash media support.

 on 3 December 2009 Android 2.0.1 Éclair was released.

on 12 January 2010 Android 2.1 Éclair was released.

VERSIONS OF ANDROID

Page 34: School updated

FROYO 2.2

On 20 May 2010, the SDK for Android 2.2 was released

» Support for Adobe Flash 10.1

» Improved Application launcher

with better browser

» No internet calling.

VERSIONS OF ANDROID

Page 35: School updated

GINGERBREAD 2.3

On 6 December 2010, the Android 2.3 (Gingerbread) SDK was

released

» Updated User Interface with high 

» efficiency and speed

» Internet calling

» One touch word selection and copy/paste.

» New keyboard for faster word input.

on 9 February 2011 Android 2.3.3 Gingerbread was released.

on 28 April 2011 Android 2.3.4 Gingerbread was released.

VERSIONS OF ANDROID

Page 36: School updated

HONEYCOMB 3.0On 22 February 2011, the Android 3.0 (Honeycomb) SDK was released

» Support for multi-core processors

» Ability to encrypt all user data.

» This version of android is only available for tablets.

on 10 May 2011 Android 3.1 Honeycomb was released.

on 15 July 2011 Android 3.2 Honeycomb was released.

VERSIONS OF ANDROID

Page 37: School updated

ICE CREAM SANDWICH 4.0On 19 October 2011, the Android 4.0 (Ice Cream Sandwich) SDK was released

» Virtual button in the UI.

» A new typeface family for the UI.

» Ability to shut down apps that are using data in the background

on 16 December 2011 4.0.3 Ice Cream Sandwich was released.

on 29 March 2012 4.0.4 Ice Cream Sandwich was released.

VERSIONS OF ANDROID

Page 38: School updated

JELLY BEAN 4.1

On 27 June 2012, the Android 4.1 (Jelly Bean) SDK was released

» User – Installable Keyboard Maps

»  Audio record triggering

» Bluetooth Data Transfer with Android Beam.

on 29 October 2012 4.2 Jelly Bean was released.

on 24 July 2013 4.3 Jelly Bean was released.

VERSIONS OF ANDROID

Page 39: School updated

KIT KAT 4.4

On 3 September 2013, the Android 4.4 (Kit Kat) SDK was released

» Built-In Screen Recording.

» Wireless printing Capability

VERSIONS OF ANDROID

Page 40: School updated

LOLLIPOP ANDROID 5.0• on June 25, 2014, the android

LolliPop 5.0 was released. • Redesigned user interface built

around a design language known as "Material design".

• Improvements to the notifications, which can be accessed from the lock screen and displayed within applications as top-of-the-screen banners.

Page 41: School updated

ANDROID FEATURES

» STRORAGESQLite, a lightweight relational database.

» CONNECTIVITYSupports GSM, CDMA, Bluetooth, Wi-Fi, WiMAX.

» MESSAGING Supports both SMS and MMS.

» MEDIA SUPPORTSupports following media files: MP3,3GP,MP4,JPEG,PNG,GIF,BMP,AMR,MIDI,...etc.

» HARDWARE SUPPORTAccelerometer sensor, Camera, GPS

Page 42: School updated

Android Application Life Cycle

» Environment Setup

» Development

» Debugging & Testing

» Deploy

Page 43: School updated

Environment Setup

Set up Your Development

Environment

Set up AVD’s and Devices for

Testing

Install the Android SDK , Android Developer Tools and Android Platform

Create Android Virtual Device and connect Hardware Device that will be used for Testing

Page 44: School updated

Development

Create Your

Application

Create Android Project with your source code, resource files and Android manifest xml file

Page 45: School updated

Debugging & TestingBuild and Run

Your Application

Debug your Application

Build and Run your ApplicationIn Debug Mode

Debug your Applications using the Android Debugging and Logging Tools

Test Your Application using theAndroid Testing and Instrumentation Framework

Test your Application

Page 46: School updated

DeployPrepare your

Application for release

Release Your Application

Configure ,build and test your application for Release Mode

Publish ,Sell and distribute your Application to users.

Page 47: School updated

Android Architecture

Android Architecture having Four Main Layer and One Sub

Layer

» Applications - Main Layer

» Application Framework - Main Layer

» Libraries - Main Layer

» Android Runtime - Sub Layer

» Linux kernel - Main Layer

Page 48: School updated

Android Architecture

Page 49: School updated

Linux Kernel

» Relying on Linux Kernel 2.6 for core system services» Memory and Process Management» Network Stack» Driver Model» Security

» Providing an abstraction layer between the H/W and the rest of the S/W stack

Page 50: School updated

Android Runtime

Core LibrariesProviding most of the functionality available in the core libraries of the Java language

Dalvik Virtual MachineProviding environment on which every Android application runs

Page 51: School updated

Libraries

» Including a set of C/C++ libraries used by components of the

Android system

» Exposed to developers through the Android application

framework

Page 52: School updated

Application Framework Layer

Feature RoleView

SystemUsed 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 strings, 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 back stack

Page 53: School updated

Application Layer

Android provides a set of core applications:

» Email Client

» SMS Program

» Calendar

» Maps

» Browser

» Contacts

Page 54: School updated

Android Architecture

Page 55: School updated

ADT- Android Developer Tools Eclipse IDE Android SDK ADT Plug-in

Java JDK 1.7

OS RequirementsWindows XP (32-bit), Vista (32- or 64-bit), or Windows 7 (32- or 64-bit)Mac OS X 10.5.8 or later (x86 only)Linux (tested on Ubuntu Linux, Lucid Lynx) On Ubuntu Linux, version 8.04 or later is required.64-bit distributions must be capable of running 32-bit applications.

How to set up Android Environment

Page 56: School updated

Components of Android

» Activity

» Services

» Broadcast Receiver

» Content Providers

Page 57: School updated

Activities

Visual user interface focused on a single thing a user can do

Services

`No visual interface – they run in the background

Broadcast Receivers

Receive and react to broadcast announcements

Content Providers Allow data exchange between applications

Page 58: School updated

» Basic component of most applications» Most applications have several activities that start each other as

needed

» Each is implemented as a subclass of the base Activity class

» Each activity has a default window to draw in.

» The content of the window is a view or a group of views.

» View(Group) made visible via Activity.setContentView() method.

Activities

Page 59: School updated

Services

» Does not have a visual interface

» Runs in the background indefinitely

» Examples

» Network Downloads

» Playing Music

» You can bind to a an existing service and control its

operation

Page 60: School updated

Broadcast Receiver

» Receive and react to broadcast announcements

» Extend the class Broadcast Receiver

» Examples of broadcasts:

» Low battery, power connected, shutdown, time zone

changed, etc.

» Other applications can initiate broadcasts

Page 61: School updated

Content Providers

» Makes some of the application data available to other applications

» It’s the only way to transfer data between applications in Android

(no shared files, shared memory, pipes, etc.)

» Extends the class Content Provider;

» Other applications use a Content Resolver object to access the data

provided via a Content Provider

Page 62: School updated

Activity Life Cycle

Each application runs in its own process.

Each activity of an app is run in the apps process

Processes are started and stopped as needed to run an apps

components.

Processes may be killed to reclaim needed resources.

Killed apps may be restored to their last state when

requested by the user

Page 63: School updated

Most management of the life cycle is done automatically by the system via the activity stack.

The activity class has the following method callbacks to

help you manage the app:–onCreate()–onStart()–onResume()–onPause()–onStop()–onRestart()–onDestroy()

Page 64: School updated

• Activities have

several states

• Lifecycle methods are

called on transitions

• You typically don’t

need to use them all,

but they are there

Page 65: School updated

DDMSDalvik Debug Monitor Service, a GUI debugging application shipped with the SDK. It provides screen capture, log dump, and process examination capabilities.Viewing heap usage for a process

DDMS allows you to view how much heap memory a process is using. This information is useful in tracking heap usage at a certain point of time during the execution of your application.Tracking memory allocation of objects

DDMS provides a feature to track objects that are being allocated to memory and to see which classes and threads are allocating the objects.

Page 66: School updated

LOGCATLogcat is integrated into DDMS, and outputs the messages that you print out using the Log class along with other system messages such as stack traces when the exceptions are thrown.Emulating phone operations and location

The emulator control tab lets you simulate a phone’s voice and data network status. This is useful when you want to test your application’s robustness in differing network environments.Changing network state, speed, and latency

The Telephony Status section of the Emulator controls tab lets you change different aspects of the phone’s networks status, speed and latency.

Page 67: School updated

Voice - unregistered, home, roaming, searching, deniedData - unregistered, home, roaming, searching, denied Speed - Full, GSM, HSCSD, GPRS, EDGE, UMTS, HSDPALatency - GPRS, EDGE, UMTS Spooling calls or SMS text messages

The Telephony Actions section of the emulator controls tab lets you spoof calls and messages.• Voice - Enter a number in the incoming number field and click

call to send a simulated call to the emulator or phone Click the Hang up button to terminate the call.

• SMS - Enter a number in the incoming number field and a message in the Message: field and click the Send button to send the message

Page 68: School updated

Views

An Activity contains Views and View Groups.

A View is a widget that has an appearance on screen.

A view derives from the base class android.view.View

Examples of views are buttons, labels and text boxes.

Textview Syntax:

TextView tv;

tv = (TextView) findViewById(R.id.textview);

tv.setText(“ Textview is displayed ”);

Page 69: School updated

User Interface

variety of widgets that are useful when creating forms, 1. image buttons, 2. text fields, 3. checkboxes, 4. radio buttons,5. Toggle buttons,6. Rating bar

Page 70: School updated

View Groups

A ViewGroup provided a layout in which the order and

appearance of the views are placed.

A view derives from the base class android.view.ViewGroup.

Android supports the following ViewGroups,

LinearLayout RelativeLayout

AbsoluteLayout TableLayout

FrameLayout ScrollView

Page 71: School updated

Linear LayoutArranges views in a single column

or single row.

Page 72: School updated

Absolute Layout• An Absolute Layout lets you specify exact locations• Enables to specify the exact location of its children.

Page 73: School updated

Table LayoutGroups views into rows and columns.

Page 74: School updated

Relative LayoutEnables us to specify how child views are positioned relative to each other.

A

B C

D

Page 75: School updated

Frame LayoutPlaceholder on screen to display as a single

view.

Page 76: School updated

NOTIFICATION • Notification is just to notify some incoming mails and login status of friends etc…• Have to import these packages import android.app.Notification;Import android.app.NotificationManager;• A Notification is a short

message breifly displayed on the status line.

Page 77: School updated
Page 78: School updated

Three of the core components of an Android application -

activities, services, and broadcast receivers - are activated

through messages, called intents

One activity starts another activity by creating/sending an

Intent

Means of leveraging activities, services, and broadcast

receivers of other applications .

Intents

Page 79: School updated

Explicit intents, Implicit intents

Types of Intents

Page 80: School updated

THANK YOU