You are on page 1of 66

MOBILE Code: 22617

APPLICATION
DEVELOPMENT

By: Ms. Z.S.Sajjade


20-04-2021 By:- Ms.Z.S.SAJJADE 1
Mobile Application Development
Code: 22617
COURSE OUTCOMES: (CO’s)
1. Interprete features of Android Operating System
2. Configure Android environment and development
tools.
3. Develop rich user interfaces by using layouts and
controls
4. Use user interface components for android
application development
5. Create Android application using database
6. Publish android application
TEACHING AND EXAMINATION SCHEME:

20-04-2021 2
UNIT I: ANDROID AND ITS TOOLS
CO 1:Interprete features of Android Operating System

Total Marks : 04

3
What is Android …..?
• Android is an open source and Linux-based operating system for
mobile devices such as smartphones and tablet computers.
• Android was developed by the Open Handset Alliance, led by
Google, and other companies.
• Android is a complete set of software for mobile devices such as
tablet computers, notebooks, smartphones, electronic book readers,
set-top boxes etc.
• The first beta version of the Android Software Development Kit
(SDK) was released by Google in 2007 where as the first commercial
version, Android 1.0, was released in September 2008.
• On June 27, 2012, at the Google I/O conference, Google announced
the next Android version, 4.1 Jelly Bean. Jelly Bean is an
incremental update, with the primary aim of improving the user
interface, both in terms of functionality and performance.
4
Prerequisites…?

Android programming is based on Java


programming language so if you have
basic understanding on Java
programming then it will be a fun to learn
Android application development

5
Why Android …..?

6
Features of Android
Android Beautiful
Beam UI Connectivity

Wi-Fi
Direct Storage

GCM
Media
support
Android

Multi-
Language Messaging

Resizable Web
widgets browser
Multi- Multi-
tasking touch

7
Android Applications (APPs)

• Android applications are usually developed in the Java language using


the Android Software Development Kit.
• Once developed, Android applications can be packaged easily and sold
out either through a store such as Google Play, SlideME, Opera
Mobile Store, Mobango, F-droid and the Amazon Appstore.
• Android powers hundreds of millions of mobile devices in more than
190 countries around the world. It's the largest installed base of any
mobile platform and growing fast. Every day more than 1 million new
Android devices are activated worldwide.

8
Categories of Android applications

9
History of Android

20-04-2021 By:- Ms.Z.S.SAJJADE 10


What is API level?
API Level is an integer value that uniquely identifies the framework API revision offered by
a version of the Android platform.

20-04-2021 By:- Ms.Z.S.SAJJADE 11


Continue…..

20-04-2021 By:- Ms.Z.S.SAJJADE 12


Android - Environment Setup (Tools)
• Operating systems
1. Microsoft Windows XP or later version.
2. Mac OS X 10.5.8 or later version with Intel chip.
3. Linux including GNU C Library 2.7 or later.
• List of software's.
1. Java JDK5 or later version
2. Android Studio (Software Development Kit-SDK)
• Android IDEs
1. Android Studio
2. Eclipse IDE(Deprecated)

20-04-2021 By:- Ms.Z.S.SAJJADE 13


Android Architecture

20-04-2021 By:- Ms.Z.S.SAJJADE 14


Linux kernel
• At the bottom of the layers is Linux - Linux 3.6
with approximately 115 patches.
• This provides a level of abstraction between the
device hardware and it contains all the essential
hardware drivers like camera, keypad, display etc.
• Also, the kernel handles all the things that Linux is
really good at such as networking and a vast array
of device drivers, which take the pain out of
interfacing to peripheral hardware.

20-04-2021 By:- Ms.Z.S.SAJJADE 15


Libraries
• On top of Linux kernel there is a set of libraries
including open-source Web browser engine
WebKit, well known library libc, SQLite database
which is a useful repository for storage and sharing
of application data, libraries to play and record
audio and video, SSL libraries responsible for
Internet security etc.

20-04-2021 By:- Ms.Z.S.SAJJADE 16


Android Libraries
• This category encompasses those Java-based libraries that are specific to Android development.
Examples of libraries in this category include the application framework libraries in addition to those
that facilitate user interface building, graphics drawing and database access. A summary of some key
core Android libraries available to the Android developer is as follows −
• android.app − Provides access to the application model and is the cornerstone of all Android
applications.
• android.content − Facilitates content access, publishing and messaging between applications and
application components.
• android.database − Used to access data published by content providers and includes SQLite database
management classes.
• android.opengl − A Java interface to the OpenGL ES 3D graphics rendering API.
• android.os − Provides applications with access to standard operating system services including
messages, system services and inter-process communication.
• android.text − Used to render and manipulate text on a device display.
• android.view − The fundamental building blocks of application user interfaces.
• android.widget − A rich collection of pre-built user interface components such as buttons, labels, list
views, layout managers, radio buttons etc.
• android.webkit − A set of classes intended to allow web-browsing capabilities to be built into
applications.

20-04-2021 By:- Ms.Z.S.SAJJADE 17


Android Runtime
• This is the third section of the architecture and available on the
second layer from the bottom. This section provides a key
component called Dalvik Virtual Machine which is a kind of
Java Virtual Machine specially designed and optimized for
Android.
• The Dalvik VM makes use of Linux core features like memory
management and multi-threading, which is intrinsic in the Java
language. The Dalvik VM enables every Android application to
run in its own process, with its own instance of the Dalvik
virtual machine.
• The Android runtime also provides a set of core libraries which
enable Android application developers to write Android
applications using standard Java programming language.
20-04-2021 By:- Ms.Z.S.SAJJADE 18
Application Framework
• The Application Framework layer provides many higher-level services
to applications in the form of Java classes. Application developers are
allowed to make use of these services in their applications.
• The Android framework includes the following key services −
• Activity Manager − Controls all aspects of the application lifecycle
and activity stack.
• Content Providers − Allows applications to publish and share data
with other applications.
• Resource Manager − Provides access to non-code embedded
resources such as strings, color settings and user interface layouts.
• Notifications Manager − Allows applications to display alerts and
notifications to the user.
• View System − An extensible set of views used to create application
user interfaces.
20-04-2021 By:- Ms.Z.S.SAJJADE 19
Applications
• You will find all the Android application at the top
layer. You will write your application to be installed
on this layer only. Examples of such applications
are Contacts Books, Browser, Games etc.

20-04-2021 By:- Ms.Z.S.SAJJADE 20


UNIT-I
END
20-04-2021 By:- Ms.Z.S.SAJJADE 21
20-04-2021 By:- Ms.Z.S.SAJJADE 22
UNIT-II

20-04-2021 By:- Ms.Z.S.SAJJADE 23


MOBILE Code: 22617

APPLICATION
DEVELOPMENT

By: Ms.Z.S.SAJJADE
20-04-2021 By:- Ms.Z.S.SAJJADE 24
UNIT 2: INSTALLATION AND CONFIGURATION OF ANDROID

CO 2:Configure Android environment and development tools.

Total Marks : 06

20-04-2021 By:- Ms.Z.S.SAJJADE 25


Operating System
• An Operating System (OS) is an interface between a computer user and
computer hardware.
• An operating system is a software which performs all the basic tasks like file
management, memory management, process management, handling input and
output, and controlling peripheral devices such as disk drives and printers.
• Some popular Operating Systems include Linux Operating System, Windows
Operating System, VMS, OS/400, AIX, z/OS, etc.

• Types of Operating System

– Batch operating system


– Time-sharing operating systems
– Distributed operating System
– Network operating System
– Real Time operating System

20-04-2021 By:- Ms.Z.S.SAJJADE 26


What is an Android Operating System?
• Android is a Linux-based operating system it is designed primarily for touch screens
mobile devices such as smartphones and tablet computers
• The operating system has developed a lot in the last 15 years starting from black and white
phones to recent smartphones or mini computers.
• One of the most widely used mobile OS   these days is android.
• Android is a powerful operating system and it supports a large number of applications on
Smartphones.
• These applications are more comfortable and advanced for users. The hardware that
supports android software is based on the ARM architecture platform.
• The android is an open-source operating system that means that it’s free and anyone can
use it.
• Android has got millions of apps available that can help you manage your life one or
another way and it is available at low cost in the market for that reason android is very
popular.
• Android development supports the full java programming language. Even other packages
that are API and JSE are not supported.
• The first version 1.0 of the android development kit (SDK) was released in 2008 and the
latest updated version is a jelly bean.
20-04-2021 By:- Ms.Z.S.SAJJADE 27
What Is the Android SDK?
• The Android SDK is a collection of software development tools and
libraries required to develop Android applications.
• Every time Google releases a new version of Android or an update, a
corresponding SDK is also released which developers must download and
install.
• It is worth noting that you can also download and use the Android SDK
independently of Android Studio, but typically you'll be working through
Android Studio for any Android development.
• The Android SDK comprises all the tools necessary to code programs from
scratch and even test them.
• These tools provide a smooth flow of the development process from
developing and debugging, through to packaging. 
• The Android SDK is compatible with Windows, macOS, and Linux, so you
can develop on any of those platforms.

20-04-2021 By:- Ms.Z.S.SAJJADE 28


What is the JDK?
• JDK is an acronym for Java Development Kit. The Java
Development Kit (JDK) is a software development environment
which is used to develop Java applications and applets. It
physically exists. It contains JRE + development tools.
• JDK is an implementation of any one of the below given Java
Platforms released by Oracle Corporation:
1. Standard Edition Java Platform
2. Enterprise Edition Java Platform
3. Micro Edition Java Platform
• The JDK contains a private Java Virtual Machine (JVM) and a few
other resources such as an interpreter/loader (java), a compiler
(javac), an archiver(jar), a documentation generator (Javadoc), etc.
to complete the development of a Java Application.

20-04-2021 By:- Ms.Z.S.SAJJADE 29


Android Developer Tools (ADT)
• Android Studio
• Eclipse IDE
– In the Eclipse application menu, go to 'Help' and then 'Install
New Software'.
– Click on the 'Add...' button and you'll see a window appear.
– Give the repository a name like 'ADT Repo'.
– Give it the location http://dl-ssl.google.com/android/eclipse/.
– Click 'OK' button.

• Visual Studio with Xamarin


• IntelliJ IDEA
20-04-2021 By:- Ms.Z.S.SAJJADE 30
Android Virtual Device (AVD)
• An Android Virtual Device (AVD) is a device
configuration that runs on the Android Emulator. It
provides virtual device-specific Android Environment in
which we can install & test our Android Application. AVD
Manager is a part of SDK Manager to create and manage
the virtual devices created.
• To open AVD manager, go to Tools → Android → AVD
Manager
• It will open AVD Manager with a list of created virtual
devices
• To create a new device, click on Create Virtual
Device button
20-04-2021 By:- Ms.Z.S.SAJJADE 31
Android Emulator
• The Android emulator is an Android
Virtual Device (AVD), which represents a
specific Android device.
• We can use the Android emulator as a target
device to execute and test our Android
application on our PC.
• The Android emulator provides almost all
the functionality of a real device.
• We can get the incoming phone calls and
text messages.
• It also gives the location of the device and
simulates different network speeds.
• Android emulator simulates rotation and
other hardware sensors.
• It accesses the Google Play store, and much
more

20-04-2021 By:- Ms.Z.S.SAJJADE 32


Dalvik Virtual Machine | DVM
• Dalvik Virtual Machine is a Register-Based virtual
machine.
• It was designed and written by Dan Bornstein with
contributions of other Google engineers as part of the
Android mobile phone platform.
• As we know the modern JVM is high performance and
provides excellent memory management. But it needs to
be optimized for low-powered handheld devices as well.
• The Dalvik Virtual Machine (DVM) is an android virtual
machine optimized for mobile devices. It optimizes the
virtual machine for memory, battery life and performance.

20-04-2021 By:- Ms.Z.S.SAJJADE 33


Dalvik Virtual Machine | DVM
• Dalvik is a name of a town “Dalvík” in Iceland.
• The Dex compiler converts the class files into
the .dex file that run on the Dalvik VM. Multiple
class files are converted into one dex file.

20-04-2021 By:- Ms.Z.S.SAJJADE 34


Dalvik Virtual Machine | DVM
• The javac tool compiles the java source file into
the class file.
• The dx tool takes all the class files of your
application and generates a single .dex file. It is a
platform-specific tool.
• The Android Assets Packaging Tool
(aapt) handles the packaging process.

20-04-2021 By:- Ms.Z.S.SAJJADE 35


20-04-2021 By:- Ms.Z.S.SAJJADE 36
20-04-2021 By:- Ms.Z.S.SAJJADE 37
Steps to Install and
configure Android studio
and SDK

https://developer.android.com/studio

20-04-2021 By:- Ms.Z.S.SAJJADE 38


UNIT-II
END
20-04-2021 By:- Ms.Z.S.SAJJADE 39
20-04-2021 By:- Ms.Z.S.SAJJADE 40
UNIT-III

20-04-2021 By:- Ms.Z.S.SAJJADE 41


MOBILE Code: 22617

APPLICATION
DEVELOPMENT

By: Ms.Z.S.SAJJADE
20-04-2021 By:- Ms.Z.S.SAJJADE 42
UNIT 3:
CO 3: Develop rich user interfaces by using layouts and controls

Total Marks : 08

20-04-2021 By:- Ms.Z.S.SAJJADE 43


Application Components
• Application components are the essential building blocks of an
Android application. These components are loosely coupled by the
application manifest file AndroidManifest.xml that describes each
component of the application and how they interact.

Sr.No Components & Description


Activities
1 They dictate the UI and handle the user interaction to the smart phone
screen.
Services
2
They handle background processing associated with an application.
Broadcast Receivers
3
They handle communication between Android OS and applications.
Content Providers
4
They handle data and database management issues.

20-04-2021 By:- Ms.Z.S.SAJJADE 44


Activities
• An activity represents a single screen with a user
interface, in-short Activity performs actions on the
screen.
• For example, an email application might have one
activity that shows a list of new emails, another activity
to compose an email, and another activity for reading
emails.
• If an application has more than one activity, then one of
them should be marked as the activity that is presented
when the application is launched.
– An activity is implemented as a subclass of Activity class as
follows −
public class MainActivity extends Activity { }
20-04-2021 By:- Ms.Z.S.SAJJADE 45
Services
• A service is a component that runs in the
background to perform long-running operations.
• For example, a service might play music in the
background while the user is in a different
application, or it might fetch data over the network
without blocking user interaction with an activity.
– A service is implemented as a subclass of Service class
as follows −
public class MyService extends Service { }

20-04-2021 By:- Ms.Z.S.SAJJADE 46


Broadcast Receivers
• Broadcast Receivers simply respond to broadcast messages
from other applications or from the system.
• For example, applications can also initiate broadcasts to let
other applications know that some data has been
downloaded to the device and is available for them to use,
so this is broadcast receiver who will intercept this
communication and will initiate appropriate action.
• A broadcast receiver is implemented as a subclass
of BroadcastReceiver class and each message is
broadcaster as an Intent object.
public class MyReceiver extends BroadcastReceiver
{ public void onReceive(context,intent){} }
20-04-2021 By:- Ms.Z.S.SAJJADE 47
Content Providers
• A content provider component supplies data from one
application to others on request. Such requests are
handled by the methods of the ContentResolver class.
The data may be stored in the file system, the
database or somewhere else entirely.
• A content provider is implemented as a subclass
of ContentProvider class and must implement a
standard set of APIs that enable other applications to
perform transactions.
• public class MyContentProvider extends
ContentProvider { public void onCreate(){} }
20-04-2021 By:- Ms.Z.S.SAJJADE 48
Additional Components
S.No Components & Description
Fragments
1 Represents a portion of user interface in an Activity.
Views
2 UI elements that are drawn on-screen including buttons, lists forms
etc.
Layouts
3 View hierarchies that control screen format and appearance of the
views.
Intents
4 Messages wiring components together.
Resources
5 External elements, such as strings, constants and drawable pictures.

Manifest
6 Configuration file for the application.

20-04-2021 By:- Ms.Z.S.SAJJADE 49


Android Application Structure

20-04-2021 By:- Ms.Z.S.SAJJADE 50


Sr.No. Folder, File & Description
Java
This contains the .java source files for your project. By default, it includes
1 an MainActivity.java source file having an activity class that runs when your app
is launched using the app icon.
res/drawable-hdpi
2 This is a directory for drawable objects that are designed for high-density
screens.
res/layout
3
This is a directory for files that define your app's user interface.
res/values
4 This is a directory for other various XML files that contain a collection of
resources, such as strings and colours definitions.
AndroidManifest.xml
5 This is the manifest file which describes the fundamental characteristics of the
app and defines each of its components.
Build.gradle
This is an auto generated file which contains compileSdkVersion,
6 buildToolsVersion, applicationId, minSdkVersion, targetSdkVersion, versionCode
and versionName
20-04-2021 By:- Ms.Z.S.SAJJADE 51
The Main Activity File
• The main activity code is a Java file MainActivity.java. This is the actual
application file which ultimately gets converted to a Dalvik executable and runs
your application.
• package com.example.helloworld;
• import android.support.v7.app.AppCompatActivity;
• import android.os.Bundle;
• public class MainActivity extends AppCompatActivity {
• @Override
• protected void onCreate(Bundle savedInstanceState) {
• super.onCreate(savedInstanceState);
• setContentView(R.layout.activity_main);
• }
• }
• Here, R.layout.activity_main refers to the activity_main.xml file located in
the res/layout folder. The onCreate() method is one of many methods that are
figured when an activity is loaded.
20-04-2021 By:- Ms.Z.S.SAJJADE 52
UI Layouts
• The basic building block for user interface is a View object which is created from the View

class and occupies a rectangular area on the screen and is responsible for drawing and event

handling.

• View is the base class for widgets, which are used to create interactive UI components like

buttons, text fields, etc.

• The ViewGroup is a subclass of View and provides invisible container that hold other Views

or other ViewGroups and define their layout properties.

• At third level we have different layouts which are subclasses of ViewGroup class and a

typical layout defines the visual structure for an Android user interface and can be created

either at run time using View/ViewGroup objects or you can declare your layout using

simple XML file main_layout.xml which is located in the res/layout folder of your project.

20-04-2021 By:- Ms.Z.S.SAJJADE 53


Sr.No Layout & Description

1 Linear Layout
LinearLayout is a view group that aligns all children in a single direction,
vertically or horizontally.

2 Relative Layout
RelativeLayout is a view group that displays child views in relative
positions.
3 Table Layout
TableLayout is a view that groups views into rows and columns.

4 Absolute Layout
AbsoluteLayout enables you to specify the exact location of its children.

5 Frame Layout
The FrameLayout is a placeholder on screen that you can use to display
a single view.

20-04-2021 By:- Ms.Z.S.SAJJADE 54


Linear Layout
• Android LinearLayout is a view group that aligns
all children in either vertically or horizontally.

20-04-2021 By:- Ms.Z.S.SAJJADE 55


Before Running After Running

20-04-2021 By:- Ms.Z.S.SAJJADE 56


Attribute & Description
android:id
This is the ID which uniquely identifies the layout.

android:divider
This is drawable to use as a vertical divider between buttons. You use a color value, in
the form of "#rgb", "#argb", "#rrggbb", or "#aarrggbb".

android:gravity
This specifies how an object should position its content, on both the X and Y axes.
Possible values are top, bottom, left, right, center, center_vertical, center_horizontal
etc.

android:orientation
This specifies the direction of arrangement and you will use "horizontal" for a row,
"vertical" for a column. The default is horizontal.

android:weightSum
Sum up of child weight

20-04-2021 By:- Ms.Z.S.SAJJADE 57


Relative Layout
• Android RelativeLayout enables you to specify how child views
are positioned relative to each other. The position of each view can
be specified as relative to sibling elements or relative to the parent.

20-04-2021 By:- Ms.Z.S.SAJJADE 58


Attribute & Description
Sr.No. Attribute & Description

android:id
1
This is the ID which uniquely identifies the layout.

android:gravity
This specifies how an object should position its content, on
2
both the X and Y axes. Possible values are top, bottom, left,
right, center, center_vertical, center_horizontal etc.

android:ignoreGravity
3
This indicates what view should not be affected by gravity.

20-04-2021 By:- Ms.Z.S.SAJJADE 59


Table Layout
• Android TableLayout going to be arranged groups of views into rows and columns.
You will use the <TableRow> element to build a row in the table. Each row has zero
or more cells; each cell can hold one View object.

20-04-2021 By:- Ms.Z.S.SAJJADE 60


Sr.No. Attribute & Description
android:id
1
This is the ID which uniquely identifies the layout.

android:collapseColumns
2 This specifies the zero-based index of the columns to collapse.
The column indices must be separated by a comma: 1, 2, 5.

android:shrinkColumns
3 The zero-based index of the columns to shrink. The column
indices must be separated by a comma: 1, 2, 5.

android:stretchColumns
4 The zero-based index of the columns to stretch. The column
indices must be separated by a comma: 1, 2, 5.

20-04-2021 By:- Ms.Z.S.SAJJADE 61


Absolute Layout
• An Absolute Layout lets you specify exact locations (x/y coordinates) of its children.
Absolute layouts are less flexible and harder to maintain than other types of layouts
without absolute positioning.

20-04-2021 By:- Ms.Z.S.SAJJADE 62


Sr.No Attribute & Description

1 android:id
This is the ID which uniquely identifies the
layout.

2 android:layout_x
This specifies the x-coordinate of the view.

3 android:layout_y
This specifies the y-coordinate of the view.

20-04-2021 By:- Ms.Z.S.SAJJADE 63


Frame Layout
• Frame Layout is
designed to block out an
area on the screen to
display a single item.
Generally, FrameLayout
should be used to hold a
single child view,
because it can be difficult
to organize child views
in a way that's scalable to
different screen sizes
without the children
overlapping each other.

20-04-2021 By:- Ms.Z.S.SAJJADE 64


Sr.No Attribute & Description
1 android:id
This is the ID which uniquely identifies the layout.

2 android:foreground
This defines the drawable to draw over the content and possible
values may be a color value, in the form of "#rgb", "#argb", "#rrggbb",
or "#aarrggbb".

3 android:foregroundGravity
Defines the gravity to apply to the foreground drawable. The gravity
defaults to fill. Possible values are top, bottom, left, right, center,
center_vertical, center_horizontal etc.

4 android:measureAllChildren
Determines whether to measure all children or just those in the
VISIBLE or INVISIBLE state when measuring. Defaults to false.

20-04-2021 By:- Ms.Z.S.SAJJADE 65


20-04-2021 By:- Ms.Z.S.SAJJADE 66

You might also like