You are on page 1of 26

Mobile Application Development

Session: Spring 2021


Kaleem Nawaz Khan
Lecturer
Department of Computer Science

University of Engineering and Technology, Mardan


Today’s Agenda
ØThe Android ecosystem
ØAndroid versioning
ØAndroid project file structure
ØApplication Fundamentals
The Android ecosystem
ØAn open source platform for mobile, embedded and wearable devices
ØGoogle is the principle maintainer
ØOther companies contribute to the system (Blackberry, Amazon etc.)
ØEach device manufacturer can customize Android to suite their needs
Android versioning
Platform version
•Android 11 (September, 2020)
•Android 10
Framework API level
•SDK compatibility
•Each platform version has an API level, i.e. Android 11 (API level 30)
NDK API level
•API level for native headers (The Android NDK is a toolset that lets you embed
components that make use of native-code languages such as C and C++, in your
Android applications.)
Android versioning
Android version 1.5: Cupcake
ØWith early 2009's Android 1.5 Cupcake release, the tradition of Android version
names was born.
ØCupcake introduced numerous refinements to the Android interface, including the
first on-screen keyboard
ØSomething that'd be necessary as phones moved away from the once-ubiquitous
physical keyboard model.
ØCupcake also brought about the framework for third-party app widgets, which would
quickly turn into one of Android's most distinguishing elements
ØIt provided the platform's first-ever option for video recording
Android versioning
Android version 1.6: Donut
ØAndroid 1.6, Donut, rolled into the world in the fall of 2009.
ØDonut filled in some important holes in Android's center, including the ability for
the OS to operate on a variety of different screen sizes and resolutions
ØA factor that'd be critical in the years to come.
ØIt also added support for CDMA networks like Verizon, which would play a key
role in Android's imminent explosion.
Android Project File Structure
Android Project File Structure
AndroidManifest.xml
Android Development
Backend
•JAVA

User Interface
•XML

Android needs two languages to develop the App. For front end XML and For
Backend JAVA. That is why it has two extensions in its files .java and .Xml
Android Development
ØEvery project in Android includes a manifest file, which
isAndroidManifest.xml, stored in the root directory of its project hierarchy.
ØThe manifest file is an important part of our app because it defines the structure
and metadata of our application, its components, and its requirements.
ØThis file includes nodes for each of the Activities, Services, Content Providers
and Broadcast Receiver that make the application and using Intent Filters and
Permissions, determines how they ordinate with each other and other
applications.
Android Development
Java
ØThe Java folder contains the Java source code files.
ØThese files are used as a controller for controlled UI (Layout file).
ØIt gets the data from the Layout file and after processing that data output will
be shown in the UI layout.
ØIt works on the backend of an Android
Android Development
Res/drawable
ØA Drawable folder contains resource type file (something that can be drawn or
Images or Shapes and Selectors).
ØDrawables may take a variety of file like Bitmap (PNG, JPEG), Nine Patch,
Vector (XML),
Android Development
Layout
ØA layout defines the visual structure for a user interface, such as the UI for an
Android application.
ØThis folder stores Layout files that are written in XML language.
ØYou can add additional layout objects or widgets as child elements to gradually
build a View hierarchy that defines your layout file.
Android Development
Layout code
Android Development
Mipmap
ØMipmap folder contains the Image Asset file that can be used in Android
Studio application.
ØYou can generate the following icon types like Launcher icons, Action bar and
tab icons, and Notification icons.
Android Development
colors.xml
colors.xml file contains color resources of the Android application. Different
color values are identified by a unique name that can be used in the Android
application program. Below is a sample colors.xml file:
•<?xml version="1.0" encoding="utf-8"?>
•<resources>
•<color name="colorPrimary">#3F51B5</color>
•<color name="colorPrimaryDark">#303F9F</color>
•<color name="colorAccent">#FF4081</color>
•</resources>
Android Development
Strings.xml
ØThe strings.xml file contains string resources of the Android application.
ØThe different string value is identified by a unique name that can be used in the
Android application program.
ØThis file also stores string array by using XML language.
Below is a sample strings.xml file:
<resources>
<string name="app_name">GeeksforGeeks</string>
</resources>
Android Development
Styles.xml
ØThe styles.xml file contains resources of the theme style in the Android application.
This file is written in XML language. Below is a sample styles.xml file:
Ø<resources> <!-- Base application theme. -->
Ø <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
Ø <!-- Customize your theme here. -->
Ø <item name="colorPrimary">@color/colorPrimary</item>
Ø <item name="colorAccent">@color/colorAccent</item>
Ø </style>
Ø</resources>
Application Fundamentals
ØApplications are written in the Java programming language
ØCompiled into an Android package file (.apk)
ØEach application runs in its own sandbox and Linux process.
ØApplication consists of components, a mainifestfile and resources.
ØComponents
Ø Activities
Ø Services
Ø Content providers
Ø Broadcast receivers
Application Fundamentals
Activities
ØAn activity represents a single screen with a user interface.
ØMost application contain multiple activities.
ØWhen a new activity starts, it is pushed onto the back stack.
ØUser interface can be build with XML or in Java
ØMonitor lifespan through callback methods like
Application Fundamentals
Services
ØServices perform long-running operations in the background.
ØDoes not contain a user interface.
ØUseful for things like network operations, playing music, etc
ØRuns independently of the component that created it.
ØCan be bound to by other application components, if allowed.
Application Fundamentals
Content Providers
ØUsed to store and retrieve data and make it accessible to all applications.
ØAre the only way to share data across applications.
ØExposes a public URI that uniquely identifies its data set.
ØData is exposed as a simple table on a database model.
ØAndroid contains many providers for this like contacts, media, etc.
Application Fundamentals
Content Providers
Application Fundamentals
Broadcast Receivers
ØA component that responds to system-wide broadcast announcements.
ØExamples include when the screen turns off, the battery is low, etc.
ØApplications can also initiate their own broadcasts.
ØBroadcasts receivers contains no user interface.
ØThey can create status bar notifications to alert the user.
Application Fundamentals
Application Fundamentals

You might also like