0% found this document useful (0 votes)
30 views

Unit I Part II

The document provides an introduction to Android, including what Android is, its history and development. It discusses the Android software development kit, Android development tools, and how to set up an Android development environment using Android Studio or ADT bundle. It also describes how to create an Android app project in Android Studio.

Uploaded by

Jatin Sharma
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views

Unit I Part II

The document provides an introduction to Android, including what Android is, its history and development. It discusses the Android software development kit, Android development tools, and how to set up an Android development environment using Android Studio or ADT bundle. It also describes how to create an Android app project in Android Studio.

Uploaded by

Jatin Sharma
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 53

Introduction to Android

Dr.G.Prabu Kanna
oooObjective
• Android Introduction
• Development Environment
• Creating an app in Android Studio
• Anatomy of Android Project
• Running the First App
• Ingredients of an Android App
Android Introduction
What is Android?
• Android is a complete set of software for mobile devices such
as tablet computers, notebooks, smartphones, electronic
book readers, set-top boxes etc.
• It contains a linux-based Operating System, middleware and
key mobile applications.
• It can be thought of as a mobile operating system. But it is not
limited to mobile only. It is currently used in various devices
such as mobiles, tablets, televisions etc.

3
Android Introduction

4
Android Introduction

• Android is a software package and linux based operating


system for mobile devices such as tablet computers and
smartphones.
• It is developed by Google and later the OHA (Open Handset
Alliance). Java language is mainly used to write the android
code even though other languages can be used.
• The goal of android project is to create a successful real-world
product that improves the mobile experience for end users.
• There are many code names of android such as Lollipop,
Kitkat, Jelly Bean, Ice cream Sandwich, Froyo, Ecliar, Donut etc
which is covered in next page.
5
Android Introduction
What is Open Handset Alliance (OHA)

• It's a consortium of 84 companies such as google, samsung,


AKM, synaptics, KDDI, Garmin, Teleca, Ebay, Intel etc.

• It was established on 5th November, 2007, led by Google. It is


committed to advance open standards, provide services and
deploy handsets using the Android Plateform.

6
Android Introduction
Features of Android
• It is open-source.
• Anyone can customize the Android Platform.
• There are a lot of mobile applications that can be chosen
by the consumer.
• It provides many interesting features like weather details,
opening screen, live RSS (Really Simple Syndication) feeds
etc.
• It provides support for messaging services(SMS and
MMS), web browser, storage (SQLite), connectivity (GSM,
CDMA, Blue Tooth, Wi-Fi etc.), media, handset layout etc.
7
Android Introduction
Features of Android
• It is open-source.
• Anyone can customize the Android Platform.
• There are a lot of mobile applications that can be chosen
by the consumer.
• It provides many interesting features like weather details,
opening screen, live RSS (Really Simple Syndication) feeds
etc.
• It provides support for messaging services(SMS and
MMS), web browser, storage (SQLite), connectivity (GSM,
CDMA, Blue Tooth, Wi-Fi etc.), media, handset layout etc.
8
Android architecture

9
Development environment
• The android development environment
consists of the following.
– Android Software Development Kit - Android SDK
– Android Development Tools - ADT
– Integrated Development Environment - IDE

10
Android software development
• The Android SDK includes a variety of tools that
help us develop mobile applications for the
Android platform. The tools are classified into
two groups:
– SDK tools
– Platform tools
SDK tools are platform independent and are required
no matter which Android platform we are
developing on. Platform tools are customized to
support the features of the latest Android platform.
11
SDK Tools
• SDK tolls are periodically updated. SDK tools
include the
– Android SDK Manager (android SDK)
– AVD Manager (android AVD)
– Emulator (emulator)
– Dalvik Debug Monitor Server (DDMS)
– Other frequently-used SDK tools

12
Android SDK Manager
• Android SDK Manager is provided for the purpose
of adding required packages or android APIs to
the Base IDE. i.e. To download and install APIs we
can use android SDK manager. It separates APIs,
platform - tools, development tools.
• In order to compile our application against a
particular version of Android, we must use the
SDK Manager to download and install the SDK
Platform for that release.

13
AVD Manager
• The AVD Manager stands for Android Virtual
Device Manager.
• As the name implies, the AVD Manager is used
for creating and managing Android Virtual
Devices.

14
Emulator
• This is one of the most important tools provided by
android SDK. The emulator is a virtual mobile device
that runs on the computer.
• It can be used to test our android applications.
• The emulator for each android project can be
configured with the help of Android Virtual Device
(AVD) Manager.
• It allows the developer to test and run the android
applications without using a physical mobile device
during development stage.
15
Dalvik Debug Monitor Server-DDMS
• Dalvik Debug Monitor Server (DDMS) is a
debugging tool.
• DDMS works with both the emulator and a
connected device.
• If both are connected and running
simultaneously, DDMS defaults to the
emulator.

16
DX.exe
• The DX.exe file is one of the most useful tools.
These .dex files are understood by android devices.
• The DX.exe works as compiler of the android SDK.
• It creates .dex extensions files when we are
running the java files.
• The .java files written in IDE, are compiled with the
help of java compiler.
• The byte code files are read and converted as .dex
(dalvik executable) format by DX tool.
17
DX.exe

Java
IDE .class files
Compiler

Dalvik VM .dex files DX.exe

18
Android Development Tools(ADT)
• Android Development Tools (ADT) is a plug-in
for the Eclipse IDE that provides a suite of
tools that are integrated with the Eclipse IDE.
• It offers access to many features that are
helpful for developing Android applications.

19
Choosing IDE
• The android development environment can be
set up by using any one of the following.
– ADT Bundle
– Android Studio

20
ADT Bundle
• We will use android studio in this guide.
However, knowing the ADT bundle installation
will give an opportunity to learn a
development environment set up for android.
• The following are the required software that
needs to be installed for developing android
applications.

21
ADT Bundle contd.,
– JDK8 - Java software
– Eclipse IDE– Development environment a tool to
write and compile and execute programs.
– Android SDK – Android Development kit which has
APIs and other tools required to run an android
app.
– ADT plug-in – Enables the Eclipse to apply the
components of ADT plug in to editing, building,
running and debugging the project.

22
ADT Bundle contd.,
• There are two different methods are available
to install and configure the android
development environment.
– Manually downloading, installing separately each
required tool and configuring them.
– Downloading and installing pre configured
package available as zip file.

23
Installing and Configuring manually
• If we want to configure them manually, we
need to follow the steps given below.
– Install JDK in the system
– Install Eclipse IDE
– Install Android SDK
– Install ADT plug in
– Create AVD using AVD Manger available in eclipse

24
Installing preconfigured package
• ADT Bundle for Windows – Compromise all of
above said tools including Eclipse.
– It consists of the following.
• Eclipse +ADT plug in
• Android SDK tools
• Android platform tools

25
Android Studio
• Android Studio is the official IDE for Android
application development, based on IntelliJ IDEA.
• It has the android build system.
• The Android build system is the toolkit used to build,
test, run and package the apps.
• Android Studio provides a memory monitor view so
the app's memory usage such as to find de-allocated
objects, locate memory leaks and track the amount
of memory the connected device is using can be
monitored.
26
Android Studio contd.,
• Some of the features of android studio are
given below.

– Flexible Gradle-based build system


– Build variants and multiple apk file generation
– Code templates to help in building common app
features
– Rich layout editor with support for drag and drop
theme editing
27
Creating an App in Android Studio
• Creating project
– To create a new project in Android Studio select
the File menu and choose ‘New Project’ option.
(File -> New project). Then a dialog box will appear
as follows.

28
Creating an App in Android Studio contd.,

29
Creating an App in Android Studio contd.,

• The package name is the name of the package


where our application code resides. Android
Studio provides default package name.
• If we wish to change the default package
name, we can use the edit option given along
the package name.

30
Creating an App in Android Studio contd.,

• After filling the fields, click next to proceed.


The next option is choosing the app type. i.e
the target device type such as phone or
tablets or TV etc.
• Also choose the minimum API level which
requires running our app. After choosing the
minimum SDK version click next to proceed.

31
Creating an App in Android Studio contd.,

32
Creating an App in Android Studio contd.,

• The next option is choosing an activity type.


Since each app at least would have one
activity, Android Studio provides options to
choose an activity type while creating project.
We can choose any type of activity we want
from the given activity types. In this demo, we
will choose ‘Blank Activity’ type. To proceed
with next step click next option. Then a dialog
box will appear as shown in the below picture.
33
Creating an App in Android Studio contd.,
• The last step in
creating project is
providing names
for activity, layout
and menu. The
activity name we
provide is the
name of the
activity file which
is created under
src directory.

34
Anatomy of Android Project
• After we create new project, it is shown in the project
explorer. The project folder has the following sub directories

• idea
• app
• build
• gradle
• External Libraries
• Other files ( .gitignore, build.gradle ,gradle.properties,
gradlew, gradlew.bat, local. Properties, MyApplication2.iml,
settings. gradle)
35
Running the First App
• Setting Emulator
– To create an emulator, we need the
help of AVD Manager. Since emulator
is a virtual device, the AVD Manager
(Android Virtual Device Manager) is
required to create and manage the
emulators.
– Android Studio provides tool bar
option to open AVD Manager. Click
the Android Virtual Device Manager
in the toolbar to open it and create
new virtual devices for running our
app in the emulator.

36
AVD Manager
• AVD Manager has updated screens with links to help us
select the most popular device configurations, screen
sizes and resolutions for our app previews.
• The AVD Manager comes with emulators for Nexus 6
and Nexus 9 devices and also supports creating custom
Android device skins based on specific emulator
properties and assigning those skins to hardware
profiles. Android Studio installs the Intel® x 86
Hardware Accelerated Execution Manager (HAXM)
emulator accelerators and creates a default emulator
for quick app prototyping.
37
AVD Manager contd.,
• When the AVD Manager
icon is selected ,the
following screen will be
shown.
• This screen will display list
of created virtual devices
or emulators with the
option to create a new
one.
• To create a new emulator,
click on the ‘Create Virtual
Device’ option. The
following dialog box will
appear with the options to
create a new one.

38
AVD Manager contd.,
• The AVD shows the list of
defined hardware profiles
such as memory, screen size,
resolution etc. To define our
own hardware profile, AVD
Manager provides an option
called ‘New Hardware Profile’.
Also we can import the
hardware profiles. The
following screen shows the
option to create new
hardware profiles.
39
AVD Manager contd.,
• We have created an android
application. To run that
application we
. have created
a virtual device. Now select
the run option to run the
application. When choosing
the run option, a dialog box
will appear with the option
to launch an emulator or
choose the existing (already
launched or running)
emulator.
40
AVD Manager contd.,

41
AVD Manager contd.,
• The emulator appears
with the typical mobile
screen. We can watch
that our app has been
installed. Now if we click
on the app icon, it will be
launched and the
outcome is shown in the
above picture. The
output is simply showing
the text ‘Hello World’.
42
Ingredients of an Android App
• The following are the android application
components
– Activity
– Intent
– Services
– Broadcast Receivers
– Content Providers

43
Ingredients of an Android App contd.,
• Activity
– Activity is an individual user interface where visual
components can be placed.
– These visual components are known as Views
(also known as widgets). The user can perform
various actions by interacting with it.
– In an android application, the whole window gives
the user an interface to interact with and
therefore this complete screen makes an Activity.

44
Ingredients of an Android App contd.,
– The controls placed in the window allow the user
to perform certain actions and are called Views or
Widgets .
– An application can have more than one activity
and each activity operates independently, but can
be linked to one another. Each activity must be
defined in application’s manifest file. Each Activity
in android will be subclass of Activity class defined
in Android SDK.

45
Ingredients of an Android App contd.,
• Intent
– Although intents are known as one among the
components, actually it is not. It is used to activate a
component in an application.
– For example, in an android application when we want
to open a image or video, an option will be shown to
the user to choose.
– The option is for mentioning how to complete the
opening action by using which editor the user wants to
open.
– Here opening of an image or a video is an activity.
46
Ingredients of an Android App contd.,
– To invoke a new activity from our current activity,
we need to fire an intent specifying the new
activity.
– And if we want to start other application from our
activity, then also we need to fire intent.
– That is by firing intent, we are telling the android
system to make something happen.

47
Ingredients of an Android App contd.,
• Service
– A service is an android application component
that runs in background and has no visual UI.
– Services are used to perform the processing parts
of our application in the background. While the
user is working on the foreground UI, services can
be used to handle the processes that need to be
done in the background.

48
Ingredients of an Android App contd.,
– A service can be started by another android
application components such as an activity or
other services and it will continue to run in the
background even after the user switches to
another application.
– Thus services are less likely to be destroyed by
Android system to free resources, than Activities.

49
Ingredients of an Android App contd.,
• Broadcast Receiver
– Broadcast receivers are one of android application
components that is used to receive messages that
are broadcasted by the android system or other
android applications. There are many broadcasts
that are initiated by the android system itself and
other applications can receive by using Broadcast
receiver.

50
Ingredients of an Android App contd.,
• Examples of broadcasts initiated by the system
are:
– Warning that the battery is getting low
– Screen turned off
– Change of time zone
– The camera has been used to take a picture

51
Ingredients of an Android App contd.,
• Content Provider
– Content providers in android provide a flexible
way to make data available across applications.
– For example, consider we are creating a to do list
in our application, and we are storing it at any
storage location such as the data base, file system
or in any online storage space.
– In a similar way we can access the data that other
utilities have created, by using content providers.

52
Ingredients of an Android App contd.,
Example for content provider in android is the
contacts database. The content provider of contacts
database allows other applications to query, read,
modify and write the contacts info. Android comes
with several other built in Content providers that we
can use in our application. All content providers are
implemented as a subclass of Content Provider class.

53

You might also like