CH 1

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 27

Lecture 1

Introduction To Mobile App


Development
Introduction to Android

• Android is a popular mobile operating system developed by Google,


based on a modified version of the Linux kernel and other open-
source software.
• It is designed primarily for touchscreen mobile devices such as
smartphones and tablets.
• Android's user interface is mainly based on direct manipulation, using
touch gestures that correspond to real-world actions, such as swiping,
tapping, and pinching, to manipulate on-screen objects.
History of Android OS
• The history of Android is a journey that began in the early 2000s and has seen the platform evolve into
the most widely used mobile operating system in the world. Here’s a detailed look at the key
milestones in the history of Android:
• Initial Release and Early Versions
• 2007: The Open Handset Alliance, a consortium of technology companies including Google, unveiled
Android. This alliance aimed to develop open standards for mobile devices.
• 2008: The first commercial version of Android (Android 1.0) was released on the HTC Dream (also
known as the T-Mobile G1). Key features included a web browser, a camera, Gmail synchronization,
Google Maps, and the Android Market (now Google Play Store).
• Major Android Versions
• Android 1.5 Cupcake (April 2009)
• Introduced an on-screen keyboard, third-party app widgets, and video recording.
• Android 1.6 Donut (September 2009)
• Added support for different screen sizes, a battery usage indicator, and text-to-speech.
• Android 2.0/2.1 Eclair (October 2009)
• Introduced HTML5 support, improved Google Maps, and a new browser UI.
Cont..
• Android 2.2 Froyo (May 2010)
• Added Wi-Fi hotspot functionality, flash support, and performance improvements.
• Android 2.3 Gingerbread (December 2010)
• Enhanced UI design, NFC support, and improved copy/paste functionality.
• Android 3.0 Honeycomb (February 2011)
• Designed specifically for tablets, featuring a new UI and improvements to multitasking.
• Android 4.0 Ice Cream Sandwich (October 2011)
• Unified the phone and tablet UI, introduced Holo design language, and facial recognition.
• Android 4.1/4.2/4.3 Jelly Bean (July 2012)
• Project Butter for smoother performance, Google Now, and expandable notifications.
• Android 4.4 KitKat (October 2013)
• Improved performance on low-end devices, introduced "OK Google" voice search, and immersive mode.
• Android 5.0/5.1 Lollipop (November 2014)
• Introduced Material Design, ART runtime, and notifications on the lock screen.
• Android 6.0 Marshmallow (October 2015)
• Enhanced app permissions, Doze mode for battery saving, and native fingerprint support.
• Focuses on system stability, better battery life, enhanced UI transitions, and additional privacy and security
features.
Cont..
• Android 7.0/7.1 Nougat (August 2016)
• Split-screen multitasking, quick settings customization, and enhanced notifications.
• Android 8.0/8.1 Oreo (August 2017)
• Picture-in-picture mode, notification dots, and autofill framework for better password management.
• Android 9 Pie (August 2018)
• Gesture navigation, adaptive battery and brightness, and digital wellbeing features.
• Android 10 (September 2019)
• System-wide dark mode, gesture navigation, and enhanced privacy controls.
• Android 11 (September 2020)
• Conversation notifications, one-time permissions, and built-in screen recording.
• Android 12 (October 2021)
• Material You design language, improved privacy dashboard, and better performance.
• Android 13 (August 2022)
• Further enhancements in UI personalization, expanded themed app icons, and enhanced security features.
• Recent Developments and Future Outlook
• Android 14 (October 2023)
• Focuses on system stability, better battery life, enhanced UI transitions, and additional privacy and security
features.
Key Features of Android:

• Open Source: Android is open source, meaning that the source code is
available for developers to modify and improve. This has led to a large
and active community of developers who contribute to the platform.
• Customizable User Interface: Android allows for a high degree of
customization. Users can personalize their home screens with widgets,
shortcuts, and apps. Manufacturers can also customize the operating
system to differentiate their devices.
• Google Play Store: Android provides access to the Google Play Store,
which is a vast marketplace for apps, games, music, movies, and books.
This makes it easy for users to find and install new applications.
• Multitasking: Android supports multitasking, allowing users to run
multiple apps simultaneously and switch between them seamlessly.
Cont..
• Notifications: Android provides a unified notification system that
allows users to receive alerts from various apps in a single place,
making it easier to stay informed about important events.
• Integration with Google Services: Android devices are deeply
integrated with Google services, such as Gmail, Google Maps, Google
Drive, and Google Assistant. This provides a seamless experience for
users who rely on these services.
• Hardware Compatibility: Android runs on a wide range of devices
from various manufacturers, providing users with many options
regarding design, features, and price.
Development and Ecosystem:
• Android development is primarily done using the Java programming
language, although Kotlin has become increasingly popular due to its
modern features and interoperability with Java.
• The Android Software Development Kit (SDK) provides developers
with the tools needed to create, test, and deploy applications.
• The ecosystem around Android is vast, including various development
tools, libraries, and frameworks that simplify and enhance the
development process.
• The Android Studio IDE is the official integrated development
environment for Android development, providing robust tools for
coding, debugging, and performance analysis.
Market Presence:

• Android dominates the global smartphone market, with a significant


market share compared to other operating systems like iOS. Its
popularity is driven by its flexibility, the variety of available devices,
and the extensive app ecosystem.
• In conclusion, Android's combination of open-source flexibility,
extensive customization options, and deep integration with Google
services has made it a preferred choice for both consumers and
developers. Its widespread adoption ensures that it will continue to
evolve and innovate, shaping the future of mobile technology.
Android app structure

• This diagram shows the basic building


blocks of an Android application.
Android application in Eclipse or in
any development tool have a pre-
defined structure with code and
resource organized into a number of
folders.

Every Android project contains


several folders.
App structure in Android studio
Android Application Folder with
description
Folder Name Description

src The 'src' stands for Source Code. It contains the Java
Source files.

gen The 'gen' stands for Generated Java Library. This


library is for Android internal use only.

Android 2.2 The Android Framework Library is stored here.

assets It is used to store raw asset files.

libs It contains private libraries.


Folder Name Description

res The 'res' stands for Resource file. It can store resource files such as pictures,
XML files, etc. It contains some additional folders such as Drawable, Layout
and Values.
anim: It is used for XML files that are compiled into animation objects.
color: It is used for XML files that describe colors.
drawable: It is used to store various graphics files. In Android project
structure,
there are three types of drawable folders,
1. drawable-mdpi
2. drawable-hdpi
3. drawable-ldpi
The above drawable folders are required in order to adapt to different screen
resolutions.
layout: It is used for placing the XML layout files, which defines how various
Android objects such as textbox, buttons, etc. are organized on the screen.
menu: It is used for defining the XML files in the application menu.
raw: The 'raw' stands for Raw Asset Files. These files are referenced from the
application using a resource identifier in the R class.
For example, good place for media is MP3 or Ogg files.
values: It is used for XML files which stores various string values, such as
titles, labels, etc.
xml: It is used for configuring the application components.
Folder Name Description

AndroidManifest.xml This file indicates the Android definition file. This file contains the
information about the Android application such as minimum Android
version, permission to access Android device capabilities such as
Internet access permission, phone permission etc.

default.properties This file contains the project settings, such as build the target. Do not
edit this file manually. It should be maintained in a Source Revision
Control System.

Proguard.cfg This file defines how ProGuard optimizes and makes your code unclear.

MainLayout.xml This file describes the layout of the page. So all the components such
as textboxes, labels, radio buttons, etc. are displaying on the
application screen.

Activity class The application occupies the entire device screen which needs at least
one class inherits from the Activity class. OnCreate() method initiates
the application and loads the layout page.
Android UI Architecture
• Android UI Architecture Android UI architecture is a fundamental aspect of developing
Android applications, involving several key components like the application context,
intents, and the activity lifecycle.
• Understanding these components is crucial for building robust and efficient Android
applications.
• 1. Application Context :
• The application context in Android refers to the environment in which the application is
running. It provides access to resources, services, and application-level operations.
• The application context is primarily used for: Accessing application resources (e.g., strings,
images).
• Launching application-level services. Registering and unregistering broadcast receivers.
• Starting activities.
• The application context is accessible throughout the application and is retrieved using the
getApplicationContext() method.
• It is essential for tasks that need a context tied to the application's lifecycle rather than a
particular activity or component.
2. Intent

• Intents are messaging objects used to request actions from other components
of the application or system. They facilitate communication between different
components (such as activities, services, and broadcast receivers) and can be
used to:
• Start an activity.
• Start a service.
• Deliver a broadcast.
• There are two types of intents:
• Explicit Intent: Specifies the component to start by name (e.g., launching a
specific activity within the same application).
• Implicit Intent: Does not specify a component. The system resolves which
component to start based on the intent's action, data, and category (e.g.,
opening a web page in a browser).
3. Activity life cycle in android
Activity Lifecycle

• The activity lifecycle is a crucial concept in Android, describing the various states an activity can go
through during its existence. Understanding these states and handling them appropriately ensures a
smooth user experience and efficient resource management. The main lifecycle methods are:
• onCreate(): Called when the activity is first created. This is where you initialize the activity, set the
content view, and perform any setup tasks.
• onStart(): Called when the activity becomes visible to the user. It indicates that the activity is about to
become interactive.
• onResume(): Called when the activity starts interacting with the user. At this point, the activity is at the
top of the activity stack and receives user input.
• onPause(): Called when the system is about to resume another activity. This is where you should save
any persistent state and release resources that are not needed while the activity is in the paused state.
• onStop(): Called when the activity is no longer visible to the user. You should release resources that
are not needed while the activity is in the stopped state.
• onDestroy(): Called before the activity is destroyed. This is the final call before the activity is removed
from memory. You should clean up any resources that need to be released.
• onRestart(): Called when the activity is being restarted after being stopped. This usually happens when
the user navigates back to the activity.
UI Components in Android

• Android provides a wide range of UI components to create interactive and user-friendly


applications. These components allow developers to build complex and intuitive
interfaces. Here are some of the key UI components:
• 1. Text Control
• Text control components in Android are used to display text to the user or receive text
input from the user.
• TextView: A basic component used to display text. It can be styled with different fonts,
colors, sizes, and other attributes.

<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello, World!"
android:textSize="18sp"
android:textColor="#000000" />
TextView example
Button
Buttons are interactive components that can be clicked to perform
actions.
<Button android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Click Me" />
CheckBox
• CheckBox: components are used to display a checkbox, which can be
checked or unchecked by the user
<CheckBox android:id="@+id/checkBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="I agree to the terms and conditions" />
Progress Bar
• ProgressBar components indicate the progress of an operation.
• <ProgressBar android:id="@+id/progressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:indeterminate="true" />
Q&A

You might also like