0% found this document useful (0 votes)
19 views58 pages

UNIT - III part 1

The document provides an overview of the Android operating system, highlighting its open-source nature and features that facilitate application development. It details the Android architecture, including the Linux kernel, application framework, and main components such as activities, services, and content providers. Additionally, it outlines the installation process for Android Studio, the official IDE for Android development, and the steps to create a new Android application.

Uploaded by

adityakumawat625
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views58 pages

UNIT - III part 1

The document provides an overview of the Android operating system, highlighting its open-source nature and features that facilitate application development. It details the Android architecture, including the Linux kernel, application framework, and main components such as activities, services, and content providers. Additionally, it outlines the installation process for Android Studio, the official IDE for Android development, and the steps to create a new Android application.

Uploaded by

adityakumawat625
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 58

(UNIT – III)

(PART – 1)
Presented By : -
Sunil Kumar Agarwal
Assistant Professor
DEPT. OF Computer Science
What is android?

Android is called as “the first complete, open, and free mobile platform”:

Complete: allows for rich application development opportunities.

Open: It is provided through open source licensing.

Free: Android applications are free to develop.

Android applications can be distributed and commercialized in a variety of ways.


Features of Android
• Free and Open Source
• Familiar and inexpensive development tools

• Freely available SDK


• Familiar Language, Familiar Development Environments
• Reasonable learning curve for developers
• Enabling development of powerful applications
• Rich, secure application integration
• No costly obstacles to publication
• Free “Market” for application
• A new growing platform
THE ANDROID VERSION

Android is the operating system for powering screens of all sizes. Android version is named after a dessert.
Android Architecture

Android architecture or Android software stack is categorized into five parts:

1. Linux kernel

2. native libraries (middleware),

3. Android Runtime

4. Application Framework

5. Applications
Android Architecture
✓ Applications – Applications is the top layer of android architecture. The pre-installed applications
like home, contacts, camera, gallery etc and third party applications downloaded from the play store
like chat applications, games etc. will be installed on this layer only. It runs within the Android run time
with the help of the classes and services provided by the application framework.

✓ Application framework – Application Framework provides several important classes which are used
to create an Android application. It provides a generic abstraction for hardware access and also helps in
managing the user interface with application resources. Generally, it provides the services with the
help of which we can create a particular class and make that class helpful for the Applications creation.
It includes different types of services activity manager, notification manager, view system, package
manager etc. which are helpful for the development of our application according to the prerequisite.
Application runtime – Android Runtime environment is one of the most important part of Android. It contains

components like core libraries and the Dalvik virtual machine(DVM). Mainly, it provides the base for the

application framework and powers our application with the help of the core libraries.

Like Java Virtual Machine (JVM), Dalvik Virtual Machine (DVM) is a register-based virtual machine and

specially designed and optimized for android to ensure that a device can run multiple instances efficiently. It

depends on the layer Linux kernel for threading and low-level memory management. The core libraries enable

us to implement android applications using the standard JAVA or Kotlin programming languages.
Platform libraries – The Platform Libraries includes various C/C++ core libraries and Java based libraries such as

Media, Graphics, Surface Manager, OpenGL etc. to provide a support for android development.

✓ Media library provides support to play and record an audio and video formats.

✓ Surface manager responsible for managing access to the display subsystem.

✓ SGL and OpenGL both cross-language, cross-platform application program interface (API) are used for 2D and 3D

computer graphics.

✓ SQLite provides database support and FreeType provides font support.

✓ Web-Kit This open source web browser engine provides all the functionality to display web content and to

simplify page loading.

✓ SSL (Secure Sockets Layer) is security technology to establish an encrypted link between a web server and a web

browser.
Linux Kernel – Linux Kernel is heart of the android architecture. It manages all the available drivers such as
display drivers, camera drivers, Bluetooth drivers, audio drivers, memory drivers, etc. which are required
during the runtime. The Linux Kernel will provide an abstraction layer between the device hardware and the
other components of android architecture. It is responsible for management of memory, power, devices etc. The
features of Linux kernel are:
✓ Security: The Linux kernel handles the security between the application and the system.
✓ Memory Management: It efficiently handles the memory management thereby providing the freedom to
develop our apps.
✓ Process Management: It manages the process well, allocates resources to processes whenever they need
them.
✓ Network Stack: It effectively handles the network communication.
✓ Driver Model: It ensures that the application works properly on the device and hardware manufacturers
responsible for building their drivers into the Linux build.
Main Components of Android An Android application consists of one or more of the following four
classifications:
1. Activities: An application that has a visible user interface is implemented via an activity. When you select
an application from the Home screen or application launcher, an activity is started.
2. Services: You can use a service for any application that needs to persist for a long time, such as a network
monitor or update-checking application.
3. Content providers: The easiest way to think about content providers is to view them as a database server. A
content provider’s job is to manage access to persisted data, such as the contacts on a phone. If your
application is very simple, you might not necessarily create a content provider, however if you are building
a larger application or one which makes data available to multiple activities and/or applications, a content
provider is the proscribed means of accessing your data.
4. Broadcast receivers: You can launch an Android application to process a specific element of data or respond
to an event, such as receiving a text message.
Components of Android Application

Android applications consist of loosely coupled components, bound by the application manifest that describes
each component and how they interact. The manifest is also used to specify the application’s metadata, its
hardware and platform requirements, external libraries, and required permissions. The following components
comprise the building blocks for all your Android applications:

Activities — It is the presentation layer of application. The UI of your application is built around one or more
extensions of the Activity class. Activities use Fragments and Views to layout and display information, and to
respond to user actions. Compared to desktop development, Activities are equivalent to Forms.

Services — These are the invisible workers of your application. Service components run without a UI, updating
your data sources and Activities, triggering Notifications, and broadcasting Intents. They are used to perform
long running tasks, or those that require no user interaction (such as network lookups or tasks that need to
continue even when your application’s Activities aren’t active or visible.)
Content Providers — Shareable persistent data storage. Content Providers manage and persist application
data and typically interact with SQL databases. They are also the preferred means to share data across
application boundaries. You can configure your application’s Content Providers to allow access from other
applications, and you can access the Content Providers exposed by others. Android devices include several
native Content Providers that expose useful databases such as the media store and contacts.

Intents — A powerful inter-application message-passing framework. Intents are used extensively throughout
Android. You can use Intents to start and stop Activities and Services, to broadcast messages system-wide or to
an explicit Activity, Service, or Broadcast Receiver, or to request an action be performed on a particular piece
of data.
Broadcast Receivers — Intent listeners. Broadcast Receivers enable your application to listen for Intents that
match the criteria you specify. Broadcast Receivers start your application to react to any received Intent,
making them perfect for creating event-driven applications.
Widgets — Visual application components that are typically added to the device home screen. A special
variation of a Broadcast Receiver, widgets enable you to create dynamic, interactive application components for
users to embed on their home screens.

Notifications — Notifications enable you to alert users to application events without stealing focus or
interrupting their current Activity. They’re the preferred technique for getting a user’s attention when your
application is not visible or active, particularly from within a Service or Broadcast Receiver. For example, when
a device receives a text message or an email, the messaging and Gmail applications use Notifications to alert
you by flashing lights, playing sounds, displaying icons, and scrolling a text summary. You can trigger these
notifications from your applications
Activities
An activity is a window that contains the user interface of your applications. An application can have zero or
more activities. Typically, applications have one or more activities, and the main aim of an activity is to
interact with the user. From the moment an activity appears on the screen to the moment it is hidden, it goes
through a number of stages, known as an activity’s life cycle. One has to understand the life cycle of an
activity to ensure that the application works correctly. To create an activity, you create a Java class that
extends the Activity base class: package net.learn2develop.Activities;
import android.app.Activity;
import android.os.Bundle;
public class MainActivity extends Activity
{
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}
Your activity class would then load its UI component using the XML file defined in your res/layout folder. In this
example, you would load the UI from the activity_main.xml file:
setContentView(R.layout.main);

Every activity you have in your application must be declared in your AndroidManifest.xml file, like this:
The Activity base class defines a series of events that governs the life cycle of an activity. Figure 2.2 shows the life
cycle of an activity and the various stages it goes through — from when the activity is started until it ends.
The Activity class defines the following events:
onCreate() — Called when the activity is first created
onStart() — Called when the activity becomes visible to the user
onResume() — Called when the activity starts interacting with the user
onPause() — Called when the current activity is being paused and the previous activity is being resumed
onStop() — Called when the activity is no longer visible to the user
onDestroy() — Called before the activity is destroyed by the system (either manually or by the system to
conserve memory)
onRestart() — Called when the activity has been stopped and is restarting again

By default, the activity created for you contains the onCreate() event. This event handler contains the
code that helps to display the UI elements of your screen.
Installing Android Studio

For developing application for android platform, you will require Integrated Development Environment (IDE).
Android Studio is the official IDE for Android application development. Android Studio provides everything you
need to start developing apps for Android, including the Android Studio IDE and the Android SDK tools. First we
discuss what the system requirements for android studio are and how to install and configure android studio.

System Requirements for Android Studio Windows


• Microsoft® Windows® 8/7/Vista/2003 (32 or 64-bit)
• GB RAM minimum, 4 GB RAM recommended
• 400 MB hard disk space
• At least 1 GB for Android SDK, emulator system images, and caches
• 1280 x 800 minimum screen resolution
• Java Development Kit (JDK) 7
• Optional for accelerated emulator: Intel® processor with support for Intel® VT-x, Intel® EM64T (Intel® 64),
and Execute Disable (XD) Bit functionality
Downloading Android Studio

Download android studio from http://developer.android.com/sdk/index.html. It will open following web page.
Downloading JDK

To download JDK 1.7 type following URL in browser.


http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads1880260.html. It will open page
shown below
Installing JDK

Double click downloaded JDK Installation file and follow instructions on screen.
Press Next Button this will start installation as shown below
Create An Android Application

First step for creation an App is Simply click on Android Studio Icon. Below Screen Will Appear, Click on Start a
new Android Studio Project
On Next Screen you need to configure your project , Here you need to fill some details like Write Application name
,Company Domain, Project Location. Please check below screen.

Click on next and Select the form factors of your app Like Minimum SDK and for which device you want to create
this Application.
And finally click on finish for ends up with Basic Steps. You are done with project creation , now its time to do work
on it. In below Image Activity is appeared ,An Activity is a class for Android App. this is a main entry point for an
App.
The user interface

You might also like