20IMCAT503
CONTENT – MODULE 1
Android SDK-ADT-AVDs-Emulators
DVM-Difference between JVM and DVM
DDMS-Android studio environment-Android application components
Android software stack structure-Android manifest file -Toast
Views – Text view-EditText-Button etc.
Layouts-Constraint layout-Linear layout-Grid layout
COURSE OUTCOME
• Construct simple Android applications using widgets
What is Android?
• Android is an open-source, Linux-based operating system developed
by Google, designed primarily for touchscreen mobile devices such
as smartphones and tablets.
History of Android
• 2003: Android Inc. was founded by Andy Rubin, Rich Miner, Nick Sears, and Chris White. The goal was to create an
advanced operating system for digital cameras — but they soon shifted focus to mobile phones.
• 2005: Google acquired Android Inc. and continued its development as an open-source mobile operating system.
• 2007: Google formed the Open Handset Alliance — a group of hardware, software, and telecom companies to advance
open standards for mobile devices.
• 2008: The first commercial Android device, the HTC Dream (also known as the T-Mobile G1), was released.
• 2010s: Android quickly became the world’s most popular smartphone operating system, adopted by companies like
Samsung, HTC, LG, and many others.
• Versions: Android versions are named alphabetically after desserts (Cupcake, Donut, Eclair, Froyo, etc.), showing its fun
branding.
• Now: Android powers billions of devices — not just smartphones, but also tablets, smart TVs, wearables, cars, and
more.
Android Versions
Android Versions
Features of Android
✓Android is open-source, so there are no licensing, distribution, or
development fees.
✓Anyone can customize the Android platform to suit their needs.
✓It provides many interesting features such as weather details, an opening
screen, live RSS (Really Simple Syndication) feeds, and more.
✓Android supports messaging services like SMS and MMS, a built-in web
browser, and local storage using SQLite.
✓It offers extensive connectivity options including GSM, CDMA, Bluetooth,
Wi-Fi, LTE, and NFC.
Features of Android
✓Android supports various media formats such as H.263, H.264,
MPEG-4 SP, MP3, Ogg Vorbis, WAV, JPEG, PNG, GIF, and BMP.
✓It provides APIs for handset layout, GPS, Wi-Fi hardware access, and
sensors like the accelerometer and compass.
✓It also supports peer-to-peer communication using Google Talk.
Android applications
Entertainment Music and Audio
Tools Social
Media and Video
Communication
Travel and Local etc.
Productivity
Personalization
Android – Environment Setup
• To develop Android applications, you need an operating system such as
Microsoft Windows XP or a later version, Mac OS X 10.5.8 or later with an Intel
chip, or Linux with GNU C Library 2.7 or later.
• You need to install the Java JDK version 5 or later.
• You should use Android Studio (the official IDE) to develop Android
applications.
• Alternatively, Eclipse IDE was used in the past, but it is now deprecated for
Android development.
Android IDES
Android SDK
• It’s a software development kit that lets developers build apps for
Android.
• It provides:
• Sample projects with source code
• Development tools
• Emulator (to test apps without a physical device)
• Required libraries and APIs
• Documentation and tutorials
Android SDK
Android SDK Structure
• The Android SDK is made up of two main parts:
• Tools
• These are executables and files that help developers build, develop, test, and debug
Android applications. Example: emulator tool
• Packages
• These are records for specific Android versions or add-ons (such as platform updates or
additional features). Example: Android 14 (API Level 34) package
• Android Virtual Devices (AVDs)
• Using the SDK, developers can create AVDs to run and test apps on an emulator —
simulating how the app works on real devices.
Android SDK
Android SDK — Key Features
• No licensing or distribution fees: Free to use — no extra cost for development or app
distribution.
• Wi-Fi hardware access: Apps can connect to Wi-Fi networks and manage Wi-Fi settings.
• Support for GSM, EDGE, and 3G: Apps can use mobile networks for calls and data transfer.
• GPS & location-based services: Get the device’s location for maps, tracking, or geo-services.
• Full multimedia hardware control: Access camera, microphone, audio, and video playback.
• APIs for accelerometer & compass: Use device sensors for motion detection and orientation.
Android SDK
• IPC (Inter-Process Communication): Share data or messages between different app
components.
• Shared data stores: Apps can save and share data using shared storage.
• Built-in WebKit browser: Apps can display web content using the open-source WebKit engine.
• Map controls integration: Add map views to app interfaces (e.g., Google Maps).
• P2P with Google Talk: Peer-to-peer communication features for chat or sharing.
• Optimized 2D/3D graphics with OpenGL ES: Hardware-accelerated graphics for smooth
gaming and UI.
• Media libraries: Play, record, and manage audio/video content.
• Reusable application framework: Use ready-made components to build apps faster and
replace default apps.
Android ADT
• It’s a plugin for the Eclipse IDE (an older popular Java development
environment).
• ADT gives you a graphical interface for many command-line tools in the
Android SDK.
• With ADT, you can:
• Create new Android projects easily.
• Design UIs using visual tools.
• Add packages and libraries from the Android Framework.
• Compile and debug your app.
• Export your app as a .apk file (signed or unsigned) for distribution.
Android AVD
• An AVD (Android Virtual Device) is like a fake phone or tablet you
run inside your computer.
• It acts as an emulator — so you can test your app without needing a
real phone.
• Why do we use AVD?
• To run and test apps on different Android versions or screen sizes.
• To see how an app looks and works on devices you don’t physically have.
• Saves time and cost — no need to buy many real devices.
Steps to create an AVD from AVD manager graphical interface
Select Tools > Android > AVD Manager > Click the AVD Manager
option in the toolbar Or Open the Device Manager icon.
Click on Create Virtual Device
Choose the Category, phone size and choose the pixels according to
your requirement.
choose the SDK Version and Click on Next button
Enter the AVD Name in Android Virtual Device and Click on Finish
button
Android AVD
Creation of an AVD
• Use the AVD Manager in
Android Studio.
• Menu: Tools → AVD Manager
• There, you can set up your
virtual device.
Android AVD
• Each AVD Has:
❖Hardware Profile:
❖ Defines the device features.
❖ Example: Does it have a camera, a keyboard, how much RAM, etc.
❖System Image:
❖ Decides which Android version it runs.
❖ Example: Android 10, Android 12, etc.
❖Emulator Skin:
❖ Controls the screen size, shape, and look.
❖ Example: Pixel phone look, tablet look.
❖Storage Area:
❖ A virtual space for user data and SD card files.
❖ Like saving photos or app data inside the emulator.
Android Emulators
• The Android SDK includes a virtual mobile device emulator that runs on
your computer.
• The emulator allows you to develop, test, and run Android applications
without needing a physical device.
• It simulates the hardware and software features of a typical mobile
device — except it cannot make actual phone calls.
• The emulator provides navigation and control keys which you can “press”
using your mouse or keyboard to generate events for your apps.
Android Emulators
• The Android emulator runs a full Android system stack, down to the
kernel level. It includes a set of pre-installed applications you can
access from your own apps.
• You can choose the Android system version you want to run by
configuring AVDs (Android Virtual Devices). You can also modify the
device skin and key mappings to match different devices.
Dalvik Virtual Machine (DVM)
• The Dalvik Virtual Machine (DVM) is a special virtual machine used by
Android to run apps.
• The Dalvik Virtual Machine is like a mini computer inside your phone that
runs your Android apps.
• Dalvik is made for small devices (phones, tablets).
• It uses files called .dex files, which are smaller than normal Java files.
• It lets every app run in its own separate space — so if one app crashes,
others keep working.
Dalvik Virtual Machine (DVM)
Dex Compiler
• The Dex Compiler takes your app’s code (Java files) and converts it into a
special format called .dex (Dalvik Executable) so that the Dalvik Virtual
Machine can run it on Android phones.
• When you write an Android app in Java, the Dex Compiler collects all your
.class files and makes a single .dex file.
• This .dex file is smaller and faster for mobile devices.
• Example: When you build your WhatsApp app in Android Studio, the Dex
Compiler makes a .dex file that runs in the Dalvik VM on your phone.
Android Emulators
Example:
➢When you open WhatsApp on your Android phone, the Dalvik
Virtual Machine takes the WhatsApp app’s code and runs it safely
inside the phone.
➢It makes sure the app uses just enough memory and doesn’t disturb
other apps.
Dalvik Virtual Machine (DVM)
• javac tool ➔ compiles the java source file into the class file
• dx tool ➔ takes all the class files of your application and generates
a single .dex file. It is a platform-specific tool.
Android Assets packaging tool (AAPT)
➔ handles the packaging process
DVM-Difference between JVM and DVM
❑JVM: The Java Virtual Machine
(JVM) runs Java programs by
converting Java bytecode into
machine code for your computer.
❑DVM: The Dalvik Virtual Machine
(DVM) runs Android apps by
executing .dex files in a way that’s
efficient for mobile devices.
DVM-Difference between JVM and DVM
JVM DVM
Java Virtual Machine Dalvik Virtual Machine
runtime environment for Java applications, Dalvik was created to be more efficient on the limited
resources available on mobile devices.
Open Source software Open-source software
Designed to execute Java bytecode on various Specifically designed for Android to execute bytecode
platforms (Windows, macOS, Linux, etc.). converted from Java bytecode.
Executes the standard Java bytecode (.class Executes Dalvik Executable (DEX) files, which are optimized
files) produced by the Java compiler. for mobile devices. The Java bytecode (.class files) is
converted into a single .dex file by the dx tool. EX files are
optimized to use less memory, which is critical in mobile
environments.
Each Java application typically runs in its own In Android, all applications run on the same instance of the
instance of the JVM, making them DVM, but in separate processes and with their own
independent of each other. instances of the DVM.
The JVM is stack-based, meaning it uses a The DVM is register-based, which is generally more efficient
stack to store operands and execute than a stack-based architecture on devices with limited CPU
instructions. and memory resources.
DVM-Difference between JVM and DVM
JVM DVM
JVM uses a Garbage Collector (GC) to manage DVM also includes a garbage collector, but it is optimized
memory and clean up unused objects. This is for the constrained environment of mobile devices,
essential for preventing memory leaks and focusing on minimizing memory usage and reducing the
optimizing performance on various platforms. impact of garbage collection pauses on the user
experience.
JVM uses Just-In-Time (JIT) compilation to DVM was designed for better performance on mobile
convert bytecode into machine code at devices with limited resources. It is more lightweight than
runtime, which improves performance after JVM and was optimized for battery life and memory usage
the code has been run several times. on mobile platforms.
JVM continues to be the standard for running DVM has been replaced by the Android Runtime (ART) in
Java applications on desktops and servers later versions of Android. ART improves performance and
memory management by using Ahead-Of-Time (AOT)
compilation.
Supports multiple operating systems Supports Android operating system
Uses More memory More efficient in terms of memory and performance
Executable file is JAR Executable file is APK
DDMS
• DDMS stands for Dalvik Debug Monitor Server.
• It’s a tool that helps Android developers monitor and debug their apps
while they run.
• What does DDMS do?
• View logs (Logcat)
• Monitor CPU and memory usage
• Simulate incoming calls or SMS
• Capture screenshots of your app
• Manage processes and threads on the emulator or device
DDMS
Example:
• When you are building an app in
Android Studio, DDMS helps you
see what’s happening inside the
app — like errors, crashes, or
background activity — so you
can fix problems faster.
Android Core Building Blocks
or
Android Application Components
Essential building blocks of an Android application are:
1. Activities
2. Services
3. Broadcast Receivers
4. Content Providers
5. Fragments
6. Views
7. Layouts
8. Intents
9. Resources
10.Manifest
Android Application Components
Activities
• Represents a single screen with a user interface.
• Performs actions on the screen
Examples:
• When you open WhatsApp, the chats screen is an Activity.
When you tap on a chat, the conversation screen is another Activity.
Android Application Components
Services
• A component that runs in the background to perform long-running
operations.
• They handle background processing associated with an application.
Examples:
• Play music in the background while the user is in a different application
• Network download
Android Application Components
Broadcast Receivers
• A Broadcast Receiver listens for system messages or app messages and
responds.
Example:
• When your phone’s battery is low, Android sends out a “Low Battery” broadcast. A
Broadcast Receiver can catch this and show a battery saver notification.
• Another example: An app that listens for SMS received and shows a
notification.
Android Application Components
Content Providers
• A Content Provider shares app data with other apps securely.
Example:
• Your Contacts app uses a Content Provider.
When you open WhatsApp and tap “Select Contact”, WhatsApp reads your
contacts through the Contacts Content Provider.
Android Application Components
Additional Components
• Fragments
• Represents a portion of user interface in an Activity.
• Views
• UI elements that are drawn on-screen including buttons, lists forms etc.
• Layouts
• View hierarchies that control screen format and appearance of the views.
Android Application Components
Additional Components
• Intents
• Messages wiring components together. A messaging object which is used to request an
action from another app component such as activities, services, broadcast receivers, and
content providers.
• Resources
• External elements, such as strings, constants and drawable pictures.
• Manifest
• Configuration file for the application.
Android studio environment
Step1: Click on Android studio icon
Android studio environment
Step2: Select New Project
Android studio environment
Step 3: Start a new android studio project
Android studio environment
Step 4: Select the minimum SDK
Android studio environment
Step5: Select the default layout for Applications
Android studio environment
• Step6: Create a new Activity
Android studio environment
Project Window:
• Left side of the screen Tool Bar:
• Displays the project's files and • Top of the screen.
folders in a hierarchical structure • Contains buttons for common actions like
running the app, debugging, and managing
configurations.
Editor Window:
• central area of the screen
• Used to write and edit your code
Tools Window:
• Around the edges of the IDE
• various utility panels that provide
additional functionality.
• Logcat: Displays logs from your running
app, which is essential for debugging.
• Build: Shows the progress and output of
build processes.
• Run: Displays the output of your running
app.
• Terminal: Provides a command-line
interface within the IDE.
• Android Profiler: Tools for analyzing the
Anatomy of Android Application
1. Contains the .java source files of the project. It
includes an MainActivity.java source file having an
activity class that runs when the app is launched
using the app icon.
2. Directory for drawable objects that are designed for
high-density screens.
3. Directory for files that define the app's user interface.
4. Directory for other various XML files that contain a
collection of resources, such as strings and colours
definitions
5. Manifest file which describes the fundamental
characteristics of the app and defines each of its
components.
6. Auto generated file which contains
compileSdkVersion, buildToolsVersion, applicationId,
minSdkVersion, targetSdkVersion, versionCode and
versionName
Android studio environment
AndroidManifest.xml File
• Heart of Android application (Most important file)
• All the components of the application are managed by this file.
• Describes the components such as activities, services, broadcast
receivers and content providers.
Android studio environment
AndroidManifest.xml File
Component Description
Declaration
<manifest> Main element in which whole structure of the manifest file is
enclosed. It is the root element of the file
<uses-sdk> Element shows the campatibility of the created application.
Contains the minimum ana maximum version of the android
application platform
<application> Major part of the manifest element as it contains declaration of the
components and attribute
<activity> Declared inside the application element. It is responsibile for the
visual UI of the application.
Android software stack structure
• Android architecture or Android software stack is categorized into
five parts.
Android software stack structure
Android software stack structure
• Linux kernel:
o Bottom layer of android (root of android architecture)
o Provides a level of abstraction between the device hardware
o Responsible for device drivers, power management, memory management, device
management and resource access.
• Libraries :
o Java-based libraries specific to Android development.
• WebKit library is responsible for browser support,
• SQLite is for database
• FreeType for font support
• Media for playing and recording audio and video formats.
Android software stack structure
• Android Runtime:
• Provides Dalvik Virtual Machine to run android applications.
• Core libraries
• Application Framework:
• Provides many higher-level services to applications in the form of Java classes.
• Includes Android API's such as UI (User Interface), telephony, resources, locations,
Content Providers (data) and package managers.
• Applications:
• Top layer
• Examples : Contacts Books, Browser, Games etc.
Android software stack structure
Application Framework
• 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.
Toasts
• A Toast in Android is a small popup message that appears briefly at the
bottom (or center) of the screen to give simple feedback to the user.
• The android.widget.Toast class is the subclass of java.lang.Object class.
• Use Toasts for:
• Showing a confirmation (e.g., “Message Sent”)
• Giving a short message (e.g., “No internet connection”)
• Providing background feedback (e.g., “Saved to gallery”)
Toasts
Duration Options
Toasts
Example
Views
• In Android, Views are the UI (User Interface) components used to
build layouts. They represent everything you see on the screen like
text, buttons, images, input fields, etc.
• Common Android Views
Views