0% found this document useful (0 votes)
35 views22 pages

Amad

Android is an open-source, Linux-based operating system developed by Google for mobile devices. Its history includes various version releases from Android 1.0 in 2008 to Android 14 in 2023, each introducing new features and optimizations. The Android architecture consists of several layers, including the Linux kernel, native libraries, Android Runtime, Application Framework, and Applications, while the Android SDK provides essential tools for app development.

Uploaded by

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

Amad

Android is an open-source, Linux-based operating system developed by Google for mobile devices. Its history includes various version releases from Android 1.0 in 2008 to Android 14 in 2023, each introducing new features and optimizations. The Android architecture consists of several layers, including the Linux kernel, native libraries, Android Runtime, Application Framework, and Applications, while the Android SDK provides essential tools for app development.

Uploaded by

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

What is Android? Explain history of Android version with API level.

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.

History Of Android :  2003–2005: Android Inc. founded; acquired by Google in 2005 to build an open
mobile OS.

 2008: Android 1.0 debuts on HTC Dream—basic smartphone features.

 2009–2011: “Cupcake” to “Ice Cream Sandwich” add on-screen keyboard, widgets, tablet UI, unified
phone/tablet design.

 2013–2015: “KitKat” and “Lollipop” introduce memory optimizations, Material Design, ART runtime.

 2016–2018: “Marshmallow” to “Pie” bring runtime permissions, Doze mode, multi-window, gesture
navigation.

 2019–2023: Android 10–14 focus on privacy (dark theme, one-time permissions), Material You, per-app
language, predictive gestures.

Internal codename[11] Version number(s) API level


— 1.0 1
Petit Four 1.1 2
Cupcake 1.5 3
Donut 1.6 4
2.0 5
Eclair 2.0.1 6
2.1 7
Froyo 2.2 – 2.2.3 8
2.3 – 2.3.2 9
Gingerbread
2.3.3 – 2.3.7 10
3.0 11
Honeycomb 3.1 12
3.2 – 3.2.6 13
4.0 – 4.0.2 14
Ice Cream Sandwich
4.0.3 – 4.0.4 15
4.1 – 4.1.2 16
Jelly Bean 4.2 – 4.2.2 17
4.3 – 4.3.1 18
4.4 – 4.4.4 19
Key Lime Pie
4.4W – 4.4W.2 20
5.0 – 5.0.2 21
Lemon Meringue Pie
5.1 – 5.1.1 22
Macadamia Nut Cookie 6.0 – 6.0.1 23
7.0 24
New York Cheesecake
7.1 – 7.1.2 25
8.0 26
Oatmeal Cookie
8.1 27
Pistachio Ice Cream[22] 9 28
[23]
Quince Tart 10 29
[23]
Red Velvet Cake 11 30
Snow Cone 12 31
[a]
Snow Cone v2 12.1 32
Tiramisu 13 33
[26]
Upside Down Cake 14 34
[27]
Vanilla Ice Cream 15 35
[28] [29]
Baklava 16 Beta 3 36

Explain Android architecture and features of Android SDK.

1. linux kernel
2. native libraries (middleware),
3. Android Runtime
4. Application Framework
5. Applications

5. Applications

Among the layers of the Android architecture, applications are at the top. Applications that come pre-installed
on the device, like contacts, music, app store, cameras, galleries, etc., as well as the ones downloaded from the
Google Play Store, such as social applications, games, professional applications, etc., will be installed only on
this layer. Applications run within Android’s runtime environment, utilizing the classes and services provided
by the application framework. A typical Android user interacts with this layer mostly for basic functions like
accessing the Web browser, making phone calls, viewing galleries, etc. Below are a few examples of some of
the standard applications that come pre-installed on every device:

 SMS client app


 Dialer
 Clock
 App store
 Web browser
 Contact manager
 Calculator
 Music, etc.

4. Application Framework

The application framework that stands on top of the native libraries and runtime layer provides us with
Application Programming Interfaces (APIs) and higher-level services. The Android Application Framework
provides classes, interfaces, and utilities that are used for the development of Android applications. Also
included in this framework is an Android Hardware Abstraction Layer (HAL), which allows the application to
communicate with hardware-specific device drivers and to manage both the UI and resources. The overall aim
of it is to provide services through which we can create a particular class and make that particular class available
for aid when creating applications. The Android framework includes the following high-level services that can
be beneficial for developing mobile applications according to our prerequisites:

3. Android Runtime

The Android Runtime Environment is an integral part of Android. It contains components such as core libraries
and the DVM (Dalvik Virtual Machine). The Android runtime, along with the libraries, powers our applications,
and is the basis for the framework.

 Similarly to JVM (Java Virtual Machine), Dalvik Virtual Machine (DVM) is a


virtual machine that is used for executing applications on Android. Android
utilizes the DVM to optimize its battery life, memory usage, and performance.
With its special design and optimization, it can facilitate multiple instances to be
run simultaneously on an Android device. In order to handle threading and low-
level memory management, it relies on the Linux kernel. This results in faster
performance as well as less memory usage.
 The Android runtime provides core libraries which let Android application
developers develop Android applications in the Java programming language.

2. Platform/Native Libraries

Several native libraries are layered on top of the Linux kernel. The Library provides the device with a set of
instructions that allow it to handle different types of data in an appropriate way. As part of Android
development, native libraries are required, and most of these libraries are open-source. It is a collection of C/C+
+ core libraries as well as Java-based libraries, which support Android development, such as Graphics, Libc,
SSL (Secure Socket Layer), SQLite, Media, Webkit, OpenGL (Open Graphic Library), Surface Manager, etc.
Here are some details about some key Android libraries that are available for Android development.

1. Linux Kernel

As with any operating system, the Linux kernel, or whatever we call it in our context, is one of the most
important components of Android’s architecture that resides at the root (bottom layer) of the entire system. It
manages all the drivers needed during the runtime of an Android device, such as camera drivers, display drivers,
audio drivers, Bluetooth drivers, and memory drivers, among others.
The Android SDK (Software Development Kit) is a collection of tools and libraries that
developers use to build Android applications. Here are the key features of the Android
SDK:

🔧 Core Features of Android SDK

1. Access to Hardware

 Android SDK allows your app to use the phone's hardware components like:
o Camera (take pictures, record videos)
o GPS (get user location)
o Accelerometer (detect phone movement/shaking)
o Microphone (record audio)
o Bluetooth/WiFi (connect to other devices)
 Example: A fitness app uses the accelerometer to count steps.

2. Data Transfer

 Apps can send and receive data using:


o Internet (HTTP APIs, RESTful services)
o Bluetooth or WiFi Direct (for nearby device communication)
o NFC (Near Field Communication)
 Example: A messaging app sends text to another user over the internet.

3. Maps and Geocoding

 Android SDK includes Google Maps integration:


o Maps API lets you display maps inside your app.
o Geocoding converts:
 Address → Latitude/Longitude
 Latitude/Longitude → Address
 Example: A delivery app shows your current location and delivery destination on a
map.

4. Background Services

 Apps can run tasks in the background (even when app is not open):
o Syncing data
o Fetching notifications
o Playing music
 Example: WhatsApp syncs messages in the background even when you're not using
the app.

5. SQLite

 Built-in lightweight database system.


 Helps store and manage data locally (on the device).
 Example: A note-taking app saves your notes in an SQLite database.

6. Widgets

 Widgets are small interactive components you can place on the home screen.
 Example: A weather app widget shows current temperature without opening the
app.

7. Media Support (2D/3D Graphics)

 Android supports:
o 2D graphics : Images, animations, UI design
o 3D graphics : Games and simulations using OpenGL ES
 Example: A racing game with 3D cars and tracks.

8. Cloud Support

 Connect apps to cloud services like Firebase or Google Cloud:


o Store files and images
o Sync data across devices
o Push notifications
 Example: Google Photos backs up images to the cloud.

9. Optimized Process and Memory Management

 Android manages apps efficiently to:


o Reduce battery usage
o Free up RAM by killing background apps when needed
o Prevent app crashes due to low memory
 Example: When switching apps, Android saves the current state so you can
continue where you left off.

Write the development environment of Android in detail.

1. Android Studio (IDE)

Android Studio is the official Integrated Development Environment for Android app
development, based on IntelliJ IDEA by JetBrains.

Key Features:

 Code Editor with intelligent code completion, linting, and refactoring.


 Layout Editor (drag-and-drop UI design using XML or Compose).
 APK Analyzer to inspect the contents of APK files.
 Emulator to test apps on virtual devices.
 Profiler Tools for CPU, memory, and network monitoring.
 Version Control Integration (Git, GitHub).
2. Programming Languages

Android development supports multiple programming languages:

 Java : Traditionally used and widely supported.


 Kotlin : The recommended modern language by Google.
 C/C ++ : For performance-criti cal parts using the NDK (Native Development Kit).
 XML : For designing UI layouts (in traditional views).

3. Android SDK (Software Development Kit)

A collection of tools needed to develop Android apps.

Includes:

 SDK Tools : Core utilities (adb, emulator, etc.).


 SDK Platforms : APIs and build tools for different Android versions.
 Build Tools : Compile, package, and debug apps (includes aapt , dx , zipalign ).
 Google APIs : For Maps, Firebase, Play Services, etc.

4. Android Virtual Device (AVD) / Emulator

Allows developers to run and test apps on different device configurations without physical
hardware.

Features:

 Simulates different screen sizes, resolutions, and Android versions.


 Supports camera, GPS, and se nsors emulation.

5. Gradle (Build System)

Handles the compilation, build, and dependency management of Android projects.

Uses:

 build.gradle files for managing dependencies and configurations.


 Supports modularization and automation of tasks (e.g., signing APKs).

6. ADB (Android Debug Bridge)

A command-line tool that allows communication with an Android device (real or


emulator).

Functions:

 Install and uninstall apps.


 Logcat for debugging.
 Run shell commands.
 Push/pull files.

7. NDK (Native Development Kit) [Optional]

Used for developing performance-sensitive components in C/C++.


Use Cases:

 Game engines
 Media processing
 Hardware interfacing

8. Additional Tools & Libraries

 Jetpack Libraries : Modern Android components (Navigation, Lifecycle, Room,


etc.).
 Firebase : Backend services (Authentication, Firestore, Analytics).
 JUnit, Espresso, Robolectric : For testing.

9. Operating System

You can set up the environment on:

 Windows
 macOS
 Linux

Android Studio works across all platforms, but iOS development is only possible on
macOS (not related to Android, but relevant for cross-platform dev).

10. Hardware Requirements

 RAM : Minimum 8 GB (16 GB recommended for smoother performance).


 Disk Space : ~4 GB for Android Studio + SDKs and emulators.
 CPU : x86/x64 with virtualization support (for Emulator).
 GPU : For rendering emulators and layout previews efficiently.

Define Intent. Explain the term exploring Intent objects and exploring intent resolution.

An intent is a messaging object used to request any action from another app component. Intents facilitate
communication between different components in several ways. The intent is used to launch an activity, start the
services, broadcast receivers, display a web page, dial a phone call, send messages from one activity to another
activity, and so on.

TYPE OF INTENT

1. Explicit Intents:

Explicit Intents explicitly specify the target component that should be invoked. By defining the target
component's class name or package name, explicit Intents enable developers to directly communicate with a
specific activity, service, or broadcast receiver within their application.

2. Implicit Intents:
Implicit Intents do not specify a particular component but rather describe the desired action and data. They
allow developers to declare an intention without knowing which specific component will handle the request.
The Android system evaluates implicit Intents and presents the user with a list of suitable components capable
of fulfilling the requested action.

Exploring Intent Objects vs Intent Resolution


Aspect Exploring Intent Objects Exploring Intent Resolution

An Intent is a messa ging object Intent Resolution is the process of


Definition used to request an action from matching an Intent to the appropriate
another app component. app component.

Used to start activities, services, Ensures the correct component handles


Purpose
or deliver broadcasts. the Intent (based on filters).

- Explicit Intent : Targets a


specific component. - Implicit Works mostly with Implicit Intents ,
Types of
Intent : Declares a general action matching them using Intent Filters
Intent
to be handled by any suitable declared in the manifest.
component.

- Intent class - Data (URI, extras) - Intent Filters in manifest -


Components
- Action (e.g., PackageManager - OS Matching
Involved
Intent.ACTION_VIEW ) Algorithm

- Starting new activity:


- Opening image in gallery when an app
Example Usage startActivity(intent) - Sending
sends an intent with type image/*
email, sharing text

java<br>Intent i = new java<br>Intent i = new


Intent(this, Intent(Intent.ACTION_VIEW);<br>i.set
Code Snippet
SecondActivity.class);<br>startA Data(Uri.parse("http://example.com"));<
ctivity(i);<br> br>startActivity(i);<br>

Enables interaction between Decides which app or component will


Significance
components and apps. respond to a given Intent.

Explain the process of creating an Activity and starting an Activity.

Creating and Starting an Activity in Android

1. What is an Activity?

An Activity in Android represents a single screen with a user interface. It acts as the entry point for user
interaction and is one of the most important components of an Android application.

Creating an Activity

To create a new Activity, the following steps are involved:

 Step 1: Define the Activity Class


A new class is created by extending the base Activity class (such as AppCompatActivity). This class
contains methods to manage the Activity lifecycle like onCreate(), onStart(), etc.
 Step 2: Design the UI Layout
The user interface for the Activity is created using XML files, which are stored in the res/layout
directory. Each Activity is typically linked to one layout file.
 Step 3: Register the Activity
Every Activity must be declared in the AndroidManifest.xml file. This allows the Android system to
know that the Activity exists and can be launched.

Starting an Activity

To launch another Activity, Intent objects are used. Intents are messaging components that facilitate
communication between different components of the app.

 Explicit Intent
This is used when the target Activity is within the same application and is known by name. It is
commonly used for navigation between screens.
 Implicit Intent
Used when the action to be performed is known, but the exact component (like a browser or camera) is
not. The system will determine the appropriate app or Activity to handle it.

Once the Intent is created, the new Activity is started using a system method that initiates the transition.

4. Activity Lifecycle (Optional, if time and space allow)

Each Activity goes through various states such as Created, Started, Resumed, Paused, Stopped, and
Destroyed. These are managed by lifecycle methods which help in resource management and user experience.

Explain the life cycle of an activity in Android.


onCreate()

This fires when the system first creates the activity. On activity creation, the activity enters the Created state. In
the onCreate() method, you perform basic application startup logic that should happen only once for the entire
life of the activity. For example, binding layout or your ViewModel.

onStart()

When the activity enters the Started state, the system invokes this callback. The onStart() call makes the activity
visible to the user, as the app prepares for the activity to enter the foreground and become interactive. Use this
where the app initializes the code that maintains the UI, like starting animation or attaching listeners or
receivers.

onResume()

When the activity enters the Resumed state, it comes to the foreground, and then the system invokes the
onResume() callback. This is the state in which the app interacts with the user. The app stays in this state until
something happens to take focus away from the app. Such an event might be, for instance, receiving a phone
call, the user navigating to another activity, or the device screen turning off.

onPause()

The onPause() callback method is called when an activity is no longer in the foreground, either because another
activity has taken focus or because the user has navigated away from the app. In this method, you should
perform any necessary actions that should happen before the activity becomes partially or completely obscured,
like stopping animation or persisting UI states.

onStop()

This method is called when an activity is no longer visible to the user and is in the process of being stopped. In
this method, you should perform any necessary actions that should be done when the activity is no longer
visible. Like, releasing the resources, and unregistering listeners or receivers.

onPause() is called when an activity is losing focus, while onStop() is called when the activity is no longer
visible to the user.

onDestroy()

onDestroy() is called before the activity is destroyed. The system invokes this callback either because:

1. the activity is finishing (due to the user completely dismissing the activity or due
to finish() being called on the activity), or
2. the system is temporarily destroying the activity due to a configuration change
(such as device rotation or multi-window mode).

Explain passing data using an Intent object.

Sure! Here's a 7-mark theory-only answer on passing data using an Intent object in Android Mobile
Application Development (AMAD), without code:

Passing Data Using an Intent Object

In Android, Intent is a messaging object used to request an action from another component (such as starting an
activity, service, or broadcasting a message). It can also be used to pass data between components, especially
between activities.
1. Types of Intents

 Explicit Intent: Used to start a specific component by name (e.g., moving from one activity to another
within the same app).
 Implicit Intent: Used to request an action that can be handled by any app (e.g., sending an email or
opening a webpage).

Data can be passed with both types of intents.

2. Using Intent to Pass Data

 The Intent object acts like a container or a carrier of data.


 It uses a method to attach data in the form of key-value pairs.
 This allows the sending component (e.g., first activity) to include extra information that the receiving
component (e.g., second activity) can retrieve and use.

3. Common Data Types Passed via Intent

 Primitive types: String, int, boolean, float, double, etc.


 Serializable or Parcelable objects: For passing custom objects (must implement Serializable or
Parcelable interface).
 Bundles: A collection of key-value pairs, useful for passing multiple values together.

4. Data Retrieval

 The receiving component extracts the data using the same key with which it was sent.
 This is typically done in the onCreate() method of the receiving activity or component.

5. Importance in Android App Development

 Data passing using intents is a fundamental part of Android application architecture.


 It supports seamless navigation and communication between components.
 Ensures that user actions (like selecting an item or filling a form) can be carried forward between
screens, enabling dynamic and interactive app behavior.

Explain two ways of creating layouts with its advantages and disadvantages.

Two Ways of Creating Layouts in Android

In Android, layouts define the structure and user interface (UI) of an application. There are two main ways to
create layouts:

1. XML-Based Layouts

Description:

 Layouts are defined using XML (Extensible Markup Language) files.


 The UI components are declared in .xml files under the res/layout directory.

Advantages:

 Separation of UI and logic – keeps the design separate from the application code.
 Easy to visualize and edit using Android Studio's Design Editor.
 Reusable – XML layouts can be reused in different activities or fragments.
 Better for team collaboration (designers and developers can work independently).

Disadvantages:

 More difficult to create dynamic or complex UIs at runtime.


 Not as flexible when UI needs to change frequently based on logic.
 May require additional effort to link with Java/Kotlin code.

2. Programmatic (Code-Based) Layouts

Description:

 Layouts are created directly in Java or Kotlin code using View objects and layout containers.
 All UI components are instantiated and arranged programmatically.

Advantages:

 More control over dynamic UI elements and real-time layout changes.


 Useful for creating UI based on conditions or user data at runtime.
 Reduces reliance on XML files for small or custom layouts.

Disadvantages:

 Makes the code more complex and harder to read.


 Difficult to manage or visualize layout without a design tool.
 Less separation between UI and logic, which can reduce maintainability.

Conclusion:

 XML-based layouts are ideal for static and well-structured UIs.


 Programmatic layouts are preferred for dynamic or highly-customized interfaces.
 A combination of both is commonly used in real-world Android development.

Explain user interface screen elements

User Interface (UI) Screen Elements in Android

In Android, the user interface (UI) is built using a hierarchy of View and ViewGroup elements. These elements
define how content is displayed and how users interact with the app.

1. View

 A View is the basic building block of UI components.


 It represents a rectangular area on the screen and is responsible for drawing and event handling.
 Common views include TextView (for displaying text), Button (for click actions), ImageView (to show
images), and EditText (for user input).

2. ViewGroup

 A ViewGroup is a container that holds other Views (or ViewGroups).


 It defines the layout structure of the UI, arranging child views in a specific manner.
 Examples include LinearLayout, RelativeLayout, ConstraintLayout, FrameLayout, etc. (Note: You
don’t need to list these if examples aren’t required.)

3. Layouts

 Layouts are XML or programmatic structures that define how UI elements are arranged on the screen.
 They help in designing responsive and adaptive interfaces for various screen sizes and orientations.

4. Widgets

 Widgets are pre-built UI components that allow user interaction.


 These include buttons, checkboxes, radio buttons, spinners, progress bars, and switches.
 Each widget serves a unique function in gathering or presenting data to the user.
5. Dialogs

 A dialog is a small window that prompts the user to make a decision or enter additional information.
 It appears on top of the current activity and pauses user interaction with the underlying screen.

6. Toasts and Snackbars

 Toast: A brief message that appears at the bottom of the screen to notify the user without blocking
interaction.
 Snackbar: Similar to a toast but more interactive, often with an action button (e.g., “UNDO”).

7. Navigation Components

 These are UI elements that help users move between screens or parts of the app.
 Includes elements like navigation drawer, bottom navigation bar, and tabs.
 Helps improve usability and app structure.

8. App Bar / Action Bar

 Displays the title, navigation options, and menu items at the top of the screen.
 Provides consistent navigation and branding for the app.

9. Fragments

 A Fragment represents a reusable portion of the UI inside an activity.


 It allows modular design and supports flexible UI for large-screen devices.

Explain in detail difference between Table Layout and Frame Layout.

Difference between Table Layout and Frame Layout


Aspect Table Layout Frame Layout

Arranges child views into rows and Displays one view on top of
Definition
columns like a table another, like a stack

Uses <TableRow> to define rows;


Single cell layout; all child views
Structure each row can have multiple cells
are stacked on top of each other
(columns)

Layout Aligns children in tabular form; Only one child is visible at a time
Behavior each cell can contain a view unless layered intentionally

Useful for forms, data display, Useful for displaying overlapping


Use Case
keypad designs views like banners, images, videos

Automatically aligns views in rows Views must be manually positioned


View Alignment
and columns using layout_gravity or margin

More structured and complex due to Simpler, mostly used for single-
Complexity
multiple rows/columns child or layered UI

Splash screens, image overlays,


Example Usage Calculator UI, signup forms
video players
explain in detail about absolute and relative layouts.

1. Absolute Layout

 Definition:
Absolute Layout allows you to specify the exact x and y coordinates of each view
(in pixels) on the screen.
It positions components based on fixed positions .
 Features:
o Every UI element is placed using absolute positioning ( layout_x , layout_y ).
o Positioning is not flexible across different screen sizes and resolutions.
o Deprecated in newer Android versions because it does not support
responsive design .
 Example (Theory):
Imagine you want to place a button exactly 50 pixels from the left and 100 pixels
from the top of the screen. You can do that in Absolute Layout. But this button
may look misaligned on different devices because pixel density varies.
 Use Case:
o Suitable only for prototypes or static screens where fixed positioning is
acceptable (rarely used in modern apps).

2. Relative Layout

 Definition:
Relative Layout arranges views relative to each other or relative to the parent
layout .
 Features:
o You can position elements above, below, to the left/right of other views.
o Can also align elements relative to the parent (e.g., center, top, bottom).
o Supports responsive design , making it suitable for multiple screen sizes.
o More flexible and powerful compared to Absolute Layout.
 Example (Theory):
Suppose you want to place a "Submit" button below a TextField and center it
horizontally. With Relative Layout, you can easily place it below another view and
align it in the center of the parent .
 Use Case:
o Login forms, settings screens, profile layouts where components need to be
aligned in relation to each other.

Comparison Summary:
Aspect Absolute Layout Relative Layout

Based on relation to other


Positioning Fixed x and y coordinates
views/parent

Flexibility Not flexible (screen-specific) Highly flexible and responsive

Use in modern apps Deprecated Widely used

Responsiveness Poor across screen sizes Excellent responsiveness

Example (Theory) Place image exactly 100px from Place image below a TextView,
Aspect Absolute Layout Relative Layout

top centered

Explain what are Resources.

In Android, resources are external, non-code elements used to build an application’s UI


and functionality. They include all the parts of an app that are not Java/Kotlin code , such
as images, strings, colors, layouts, animations, and styles .

Resources are stored separately from the source code in the res/ (resources) directory of
the Android project. This separation allows easier management, localization, and reuse
of content across different devices and configurations (like screen sizes, languages, and
themes).

Types of Resources in Android

1. String Resources ( res/values/strings.xml )


o Store all text used in the app (labels, messages, titles)
o Helps in supporting multiple languages (localization)
o Example: App title, error messages, button text
2. Image Resources ( res/drawable/ )
o Stores images like PNG, JPEG, or vector graphics used in the UI
o Example: App icons, background images, logos
3. Layout Resources ( res/layout/ )
o XML files that define the user interface design (screen structure)
o Example: Login screen layout, home screen layout
4. Color Resources ( res/values/colors.xml )
o Stores color values (hex codes or references) for consistent styling
o Example: Primary butt on color, background color
5. Dimension Resources ( res/values/dimens.xml )
o Used to define standard spacing, text size, padding
o Helps maintain consistency and scalability across devices
6. Style and Theme Resources ( res/values/styles.xml )
o Used for setting a uniform look and feel across the app
o Example: Font size, color, button shape, dark mode support
7. Menu Resources ( res/menu/ )
o Define items that appe ar in app menus or toolbars
o Example: Settings, About, Share options in the top-right menu

Why Resources are Important

 Localization : Supports different languages and regions


 Device Compatibility : Supports multiple screen sizes and resolutions
 Maintenance : Easier to update UI elements without changing code
 Reusability : Resources like styles or colors can be reused across multiple screens

Explain Resource Directory Hierarchy.

Resource Directory Hierarchy in Android

In Android, resources are external elements like images, strings, layouts, colors, and more
that are kept separate from the source code. These resources are stored in the res/
(resource) directory. This separation helps in easier maintenance, localization, and device
compatibility.
Main Resource Subdirectories
Directory
Purpose
Name

Contains XML files that define the UI layout of activities or fragments.


res/layout/
Example: activity_main.xml

Stores images and graphic files such as .png , .jpg , .xml (shapes or
res/drawable/
selectors). Example: logo.png , button_background.xml

Contains XML files for fixed values used in the app, like strings, colors,
res/values/
dimensions, styles. Examples: strings.xml , colors.xml , styles.xml

Holds launcher icons for different screen densities. Replaces older use of
res/mipmap/
drawable for app icons. Example: ic_launcher.png

Stores XML files for menus (Options menu, Context menu). Example:
res/menu/
main_menu.xml

Contains animation XML files used to animate views. Example:


res/anim/
slide_in.xml , fade_out.xml

Used to store raw files like audio, video, or text that are accessed as raw
res/raw/
streams. Example: intro_music.mp3

Contains custom font files like .ttf or .otf for typography styling. Example:
res/font/
roboto.ttf

Stores arbitrary XML configuration files . Example: network_config.xml ,


res/xml/
preferences.xml

Used for color state list XML files to define dynamic colors based on
res/color/
states. Example: button_color.xml

Example Explanation (Theoretical):

When an app is built, these resource files are compiled into a binary format and accessed
using resource IDs . For example, if there is a string "Welcome" defined in
res/values/strings.xml , it can be used in the app using R.string.welcome .

Likewise, if a layout is defined in res/layout/activity_main.xml , it can be used in an


activity using setContentView(R.layout.activity_main) .

Advantages of Resource Directory Structure:

 Supports localization (e.g., values-fr/ for French strings)


 Optimized for device compatibility (e.g., drawable-hdpi/ , layout-land/ )
 Helps in separating UI from logic , improving maintainability
Explain how we can reference the system resources.

Referencing System Resources in Android

In Android, system resources refer to the pre-defined resources provided by the Android operating system,
such as built-in layouts, strings, drawables, colors, styles, animations, and more.

These resources can be referenced using the android.R class, which points to the resources packaged within
the Android framework.

1. What is R ?

 In Android, every resource (image, layout, string, etc.) is assigned a unique ID and stored in a class
called R.
 For system resources (those provided by Android OS), we use android.R, not the project's local R.

2. Structure of Reference

System resources are referenced using the format:

android.R.<resource_type>.<resource_name>

 android.R: Refers to the system's default resources.


 <resource_type>: Category of the resource like string, layout, drawable, color, etc.
 <resource_name>: Actual name of the resource defined by the system.

3. Example (Theoretical)

 To use the default Android OK button text, you can reference it as:
→ android.R.string.ok
 To apply a default system theme, reference:
→ android.R.style.Theme_Light
 To use a built-in Android icon, you might refer to:
→ android.R.drawable.ic_menu_camera
 To use a standard Android layout, like a simple list item:
→ android.R.layout.simple_list_item_1

4. Benefits of Referencing System Resources

 Consistency: Ensures your app uses familiar UI components already recognized by users.
 Saves Time: Reduces effort by reusing what’s already available in the framework.
 Smaller APK: Avoids duplicating resources, helping reduce app size.
 Better Compatibility: Built-in resources are optimized for performance and accessibility across
various Android devices.

Explain any four UI components of Android application.

Android provides a wide range of User Interface (UI) components to design interactive
and user-friendly mobile apps. Here are four commonly used UI components:

1. TextView

 Purpose: Displays text to the user.


 Features:
o Can show plain or styled text (bold, italic, color, etc.)
o Commonly used for labels, messages, or static content
 Example (theory): In a login screen, "Username" and "Password" labels are shown
using TextView.
2. EditText

 Purpose: Allows user input in the form of text.


 Features:
o Used for forms, login, search bars
o Can specify input type (text, number, password, email, etc.)
 Example (theory): In a registration form, user types their name and email using
EditText fields.

3. Button

 Purpose: Performs an action when clicked by the user.


 Features:
o Can display text or images
o Triggers events like submitting forms, opening screens, or performing
calculations
 Example (theory): In a calculator app, numbers and operations (+, –, =) are
triggered using Buttons.

4. ImageView

 Purpose: Displays an image in the UI.


 Features:
o Supports static images (PNG, JPEG) and drawable resources
o Can scale, crop, or adjust image display options
 Example (theory): In a gallery app, photos are displayed using multiple
ImageView components.

Describe SQ lite. How it is used to Manage Data?

What is SQLite?

 SQLite is a lightweight, open-source, embedded relational database used to


store structured data in Android applications.
 It is built into the Android OS and requires no separate server or setup.
 It supports standard SQL syntax (e.g., SELECT , INSERT , UPDATE , DELETE ) to
perform database operations.

Key Features of SQLite:

 Serverless and self-contained


 Fast and reliable for small to medium datasets
 Requires no configuration or setup
 Stores data in a single .db file within the device’s internal storage
 Supports ACID (Atomicity, Consistency, Isolation, Durability) properties

How SQLite is Used to Manage Data in Android:

1. Creating a Database
o A developer defines a custom database by extending the SQLiteOpenHelper
class.
o The database is created when the app is installed or first run.
2. Creating Tables
o Tables are created using SQL CREATE TABLE queries inside the
onCreate() method.
o Each table contains columns that define the data types (e.g., name, age,
email, etc.).
3. Inserting Data
o When the user performs an action (like filling a form), the app inserts data
using an SQL INSERT command.
4. Reading Data
o The app retrieves data using the SELECT query.
o For example, when showing a list of users, the app fetches records from the
database.
5. Updating Data
o The UPDATE command is used when users modify previously stored
information (like editing a profile).
6. Deleting Data
o The DELETE command removes unwanted records from the table.
7. Closing the Database
o After operations are complete, the database connection is closed to free up
resources.

Real-World Example in Theory (No Code):

Suppose you're building a Notes app .

 You can create a "Notes" table with columns like ID , Title , and Content .
 When the user writes a new note, it gets inserted into the database.
 To show all notes, the app performs a SELECT query.
 If a user edits a note, the app updates that record.
 When deleting a note, the app removes it using the DELETE command.

Create an application using Android and write the process of deploying.

Create and Deploy an Android Application (Theory)

1. Application Idea

Let’s consider a basic example:


“To-Do List App” – An app that allows users to add, delete, and mark tasks as completed.

2. Steps to Create the Android Application

Step 1: Set Up Development Environment

 Install Android Studio (official IDE).


 Set up Java/Kotlin SDK and Android SDK .
 Create a new project with default configurations (name, package name, API level ,
etc.).

Step 2: Design the User Interface (UI)

 Use XML in activity_main.xml to create components like:


o EditText (for task input)
o Button (to add task)
o ListView or RecyclerView (to display task list)

Step 3: Add Functionality

 In the main activity (e.g., MainActivity.java or .kt ):


o Write code to handle user input
o Add new tasks to a list
o Mark tasks as done
o Store data using in-memory lists or SQLite/Room database

Step 4: Test the App

 Use the Android Emulator or a real device to run and test the app.
 Check for bugs, layout issues, and performance.

3. Deployment Process

Step 5: Build the App (APK/AAB)

 Go to Build → Build Bundle(s) / APK(s)


 Generate a signed APK or Android App Bundle (AAB)
 AAB is preferred for Google Play Store

Step 6: Create Developer Account

 Register for a Google Play Developer account (one-time fee required)

Step 7: Upload to Play Store

 Go to the Google Play Console


 Create a new app entry with name, description, category, and screenshots
 Upload the signed APK/AAB
 Set content rating, pricing (free or paid), and target audience
 Submit for review

Step 8: Publish

 After approval by Google, the app becomes live and available to users globally

Explain Android Networking API's.

Android Networking APIs

In Android development, networking APIs are used to enable communication between an


app and remote servers, services, or other devices over the internet (HTTP, HTTPS) or a
local network.

1. HttpURLConnection

 It is a core Java class available in Android for making HTTP requests.


 Lightweight and efficient for basic networking tasks like GET and POST requests.
 Suitable for downloading or uploading small amounts of data.
 Example (in theory): An app uses HttpURLConnection to download an image from
a website and display it in an ImageView .

2. Volley (Google Library)

 High-level networking library provided by Google.


 Simplifies network calls, especially for smaller and faster operations like sending
JSON requests or image loading.
 Automatically handles background threading and request queuing.
 Example (in theory): A weather app uses Volley to fetch current temperature data
from an online API and display it to the user instantly.

3. Retrofit (by Square)

 A powerful and modern HTTP client for Android.


 Converts JSON/XML API responses directly into Java/Kotlin objects using
converters like Gson or Moshi.
 Supports RESTful APIs, easy integration, error handling, and authentication.
 Example (in theory): A shopping app uses Retrofit to fetch product listings from a
REST API and display them in a list with product names, images, and prices.
4. OkHttp (Low-level client used by Retrofit)

 Efficient, low-level HTTP client.


 Supports advanced features like connection pooling, GZIP compression, and
caching.
 Used behind the scenes in Retrofit but can also be used separately for fine-grained
control.
 Example (in theory): A messaging app uses OkHttp for handling real-time chat
requests and file uploads.

5. WebSockets (for real-time communication)

 Provides full-duplex communication channels over a single TCP connection.


 Useful for real-time applications like chat apps or online multiplayer games.
 Example (in theory): A live quiz app uses WebSocket to receive questions and
leaderboard updates instantly as users answer.

Write the short note on sharing data to the application.

In Android, sharing data between applications or within components of the same


application is an important functionality. Android provides several methods to allow apps
to share data securely and efficiently.

1. Using Intents (for Inter-App Communication)

 Intents are messaging objects used to request actions from other components (e.g.,
starting an activity or service).
 You can share data (text, image, file, etc.) between apps using implicit intents .
 Example: A user selects a photo in the gallery and shares it to a messaging app via
the “Share” button.
o The system shows a list of apps that can handle the shared data (like
WhatsApp, Gmail, etc.).
o The selected app receives the image via an Intent and displays it.

2. Content Providers (for Structured Data Sharing)

 Content Providers manage access to a central data repository and allow other
apps to securely read/write data.
 They use content URIs to identify data and permissions to control access.
 Example: A contacts app exposes contact data using a content provider. A
messaging app can read contact names and numbers through this provider, with
permission.

3. Shared Preferences & Internal Storage (for Intra-App Sharing)

 Data can be shared between components (activities, services) within the same app
using Shared Preferences (key-value pairs), Internal Storage, or SQLite databases.
 This method is not for sharing between apps , but for storing data to be reused
across sessions.

4. External Storage (Limited Inter-App Access)

 Apps can write files (e.g., documents, images) to external storage which may be
accessible by other apps.
 Starting from Android 10+, access to shared storage is restricted due to scoped
storage for better privacy.

5. Clipboard Manager

 Used to copy data (text, images) to the clipboard, which other apps can paste.
 Useful for temporary data sharing, like copying a phone number from one app and
pasting it into another.

You might also like