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

CH 1

Uploaded by

abdulelah.ak1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views

CH 1

Uploaded by

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

Mobile

Applications
Development

Basic Concepts of Android


Course Outcome
CO 1 Use android/iOS framework in developing mobile applications.
Android
1. Android is a mobile operating system developed primarily for touchscreen mobile
devices like smartphones and tablets.
2. It is based on a modified version of the Linux kernel and other open-source applications.
3. It is a software package.
3. It is a product of Open Handset Alliance that is a group of developers working together
to create Android.
4. The most widely used version is primarily developed by Google.
5. Android is the most popular operating system in the world, with over 3 billion active
users across 190 countries.
6. The first Android device, the HTC Dream, was released in September 2008, although it
was initially announced in November 2007.
Android
The platform changing what mobile can do.

1. Powering your phone, tablet, watch, TV and


car.
2. Always pushing what’s possible.
3. Your phone stays safe with built-in security.
4. You stay in control of your data.
5. Everything you need to get going.
6. And much more

https://www.android.com/what-is-android/
History of Android
from 2008-2023
Name Version number release date

Android 1.0 1 September 23, 2008

Android 1.1 1.1 February 9, 2009

Android Cupcake 1.5 April 27, 2009

Android Donut 1.6 September 15, 2009

Android Eclair 2.0 October 27, 2009

Android Froyo 2.2 – 2.2.3 May 20, 2010

Android Gingerbread 2.3 – 2.3.2 December 6, 2010

Android Honeycomb 3.0 February 22, 2011

Android Ice Cream Sandwich 4.0 – 4.0.2 October 18, 2011

Android KitKat 4.4 – 4.4.4 October 31, 2013

Android Lollipop 5.0 – 5.0.2 November 4, 2014

Android Marshmallow 6.0 – 6.0.1 October 2, 2015

Android Nougat 7.0 August 22, 2016

Android Oreo 8.0 August 21, 2017

Android Pie 9 August 6, 2018

Android 10 10 September 3, 2019

Android 11 11 September 8, 2020

Android 12 12 October 4, 2021

Android 13 13 August 15, 2022

Android 14 14 February 8, 2023


Features of Android
1. Open source
2. Programming platform
3. Beautiful UI
4. Connectivity
5. Messaging
6. Storage
7. Multi language support
8. Resizable widgets
9. Customize your phone to your personal style.
10.Security that keeps your data protected all day.
11.and much more
Development
Platforms
1. Android Studio

2. Android Debug Bridge (ADB)

3. Eclipse

4. Vysor

5. FlowUp

6. Stetho

7. GameMaker Studio

8. Gradle

9. Android Asset Studio

10. RAD Studio

11. AVD Manager

12. LeakCanary

13. Unity 3D

14. NimbleDroid

15. Instabug
Android
Framework
Layers
1. Applications
2. Application framework
3. Libraries and Android runtime
4. Linux Kernel
Linux Kernel
This provides a level of abstraction between the device hardware and it
contains all the essential hardware drivers like camera, keypad, display etc.
Also, the kernel handles all the things that Linux is really good such as
networking and a vast array of device drivers, which take the pain out of
interfacing to peripheral hardware.
• Device drivers
• Memory management
• Process management
• Networking
Libraries
• Surface manager – Handling UI Windows
• C/C++ libraries
• Interface through Java
• 2D and 3D graphics
• Media codecs, SQLite, Browser engine
android.app − Provides access to the application model and is the cornerstone of all Android
applications.
android.content − Facilitates content access, publishing and messaging between applications and
application components.
android.database − Used to access data published by content providers and includes SQLite
database management classes.
android.opengl − A Java interface to the OpenGL ES 3D graphics rendering API.
android.os − Provides applications with access to standard operating system services including
messages, system services and inter-process communication.
android.text − Used to render and manipulate text on a device display.
android.view − The fundamental building blocks of application user interfaces.
android.widget − A rich collection of pre-built user interface components such as buttons, labels,
list views, layout managers, radio buttons etc.
android.webkit − A set of classes intended to allow web-browsing capabilities to be built into
applications.
FreeType is a popular software development library used to render text onto bitmaps, and provides
support for other font-related operations. The FreeType font rasterization engine is free and open-
source software with the source code.
Android Runtime

This section provides a key component called Dalvik Virtual Machine which is a
kind of Java Virtual Machine specially designed and optimized for Android.
The Dalvik VM makes use of Linux core features like memory management and
multi-threading etc. The Dalvik VM enables every Android application to run in its
own process, with its own instance of the Dalvik virtual machine.
The Android runtime also provides a set of core libraries which enable Android
application developers to write Android applications using standard Java
programming language.
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.
• Android Windows Manager is basically a file manager, which allows you to
manage files in multiple windows.
Applications

• You can find all the Android application at


the top layer. You can write your
application to be installed on this layer
only. Examples of such applications are
Contacts Books, Browser, Games etc.
Dalvik runtime
The Dalvik Virtual Machine (DVM) is an android virtual machine optimized for
mobile devices. It optimizes the virtual machine for memory, battery life and
performance.

Dalvik is a name of a town in Iceland. The Dalvik VM was developed by Dan


Bornstein.
The Dex compiler converts the class files into the .dex file that run on the
Dalvik VM. Multiple class files are converted into one dex file.

APK: Android Application Package. File Extension: .apk. An APK file is the file
format used to install the applications on android
DALVIK RUNTIME…..

The javac tool compiles the java source file into the class file.

The dx tool takes all the class files of your application and
generates a single .dex file. It is a platform-specific tool.

The Android Assets Packaging Tool (aapt) handles the


packaging process.

16
Android applications are
compiled to Dalvik
bytecode
Write app in Java
Compiled in Java

Transformed to Dalvik bytecode

Loaded into Dalvik VM

Linux OS
Application Building Blocks
Application components are the essential building blocks of an Android
application. There are following four main components that can be used
within an Android application −

1 Activities
They dictate the UI and handle the user interaction to the
smart phone screen.
Services
2 They handle background processing associated with an
application.
Broadcast Receivers
3 They handle communication between Android OS and
applications.
Content Providers
4 They handle data and database management issues.
ACTIVITIES
An activity represents a single screen with a user interface,
in-short Activity performs actions on the screen. For
example, an email application might have one activity that
shows a list of new emails, another activity to compose an
email, and another activity for reading emails. If an
application has more than one activity, then one of them
should be marked as the activity that is presented when
the application is launched.
An activity is implemented as a subclass of Activity class
as follows −
public class MainActivity extends Activity {
}
SERVICES
A service is a component that runs in the background to perform long-running
operations. For example, a service might play music in the background while
the user is in a different application, or it might fetch data over the network
without blocking user interaction with an activity.

A service is implemented as a subclass of Service class as follows −

public class MyService extends Service {


}
BROADCAST RECEIVERS
Broadcast Receivers simply respond to broadcast messages from other
applications or from the system. For example, applications can also initiate
broadcasts to let other applications know that some data has been downloaded
to the device and is available for them to use, so this is broadcast receiver who
will intercept this communication and will initiate appropriate action.
 A broadcast receiver is implemented as a subclass of BroadcastReceiver class
and each message is broadcaster as an Intent object.
public class MyReceiver extends BroadcastReceiver {
public void onReceive(context,intent){}
}
CONTENT PROVIDERS
A content provider component supplies data from one application to others on
request. Such requests are handled by the methods of the ContentResolver
class. The data may be stored in the file system, the database or somewhere
else entirely.
A content provider is implemented as a subclass of ContentProvider class and
must implement a standard set of APIs that enable other applications to
perform transactions.
public class MyContentProvider extends ContentProvider {
public void onCreate(){}
}
Additional Components

S.No Components & Description


Fragments
1 Represents a portion of user interface in an Activity.
Views
2 UI elements that are drawn on-screen including buttons, lists forms etc.
Layouts
3 View hierarchies that control screen format and appearance of the views.
Intents
4 Messages wiring components together.
Resources
5 External elements, such as strings, constants and drawable pictures.
Manifest
6 Configuration file for the application.
INTENT
Android Intent is the
message that is
passed between
components such as
activities, content
providers, broadcast
receivers, services
etc. It is generally Intent i = new Intent(this,
used with ActivityTwo.class);
startActivity() startActivity(i);
method to invoke
activity, broadcast
receivers etc. An intent allows you to start an activity
in another app by describing a simple
action.
DEVELOPMENT TOOL
 Android Studio 2022/2023
MY FIRST ANDROID APPLICATION
 The first step is to create a simple Android Application using Android studio.
When you click on Android studio icon, it will show screen as shown below
 FileNewNew Project
 Select Empty Activity and click Next
Enter Name and Click Finish
DESIGN THE INTERFACE
ANATOMY OF ANDROID APPLICATION
ANATOMY
Sr. No. Folder, File & Description
Java
This contains the .java source files for your project. By default, it includes
1 an MainActivity.java source file having an activity class that runs when your app
is launched using the app icon.

res/drawable
2 This is a directory for drawable objects that are designed for high-density
screens.
res/layout
3 This is a directory for files that define your app's user interface.
res/values
4 This is a directory for other various XML files that contain a collection of
resources, such as strings and colours definitions.
AndroidManifest.xml
5 This is the manifest file which describes the fundamental characteristics of the
app and defines each of its components.
Build.gradle
This is an auto generated file which contains compileSdkVersion,
6
buildToolsVersion, applicationId, minSdkVersion, targetSdkVersion, versionCode
and versionName
THE MAIN ACTIVITY FILE

 The main activity code is a Java file MainActivity.java. This


is the actual application file which ultimately gets
converted to a Dalvik executable and runs your
application. Following is the default code generated by
the application wizard for Hello World! application −

package com.example.myapplication;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
THE MANIFEST FILE
Whatever component you develop as a part of your application, you
must declare all its components in a manifest.xml which resides at the
root of the application project directory. This file works as an interface
between Android OS and your application, so if you do not declare your
component in this file, then it will not be considered by the OS. For
example, a default manifest file will look like as following file −
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myapplication">

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category
android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
THE LAYOUT FILE
 The activity_main.xml is a layout file available in res/layout
directory, that is referenced by your application when
building its interface. You will modify this file very frequently
to change the layout of your application. For your "Hello
World!" application, this file will have following content
related to default layout −
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">

<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>
RUNNING THE
APPLICATION
 To run the app from Android
studio, click Run Icon from the
tool bar. Android studio installs
the app on your AVD and starts
it and if everything is fine with
your set-up and application, it
will display following Emulator
window −
Questions & answers

You might also like