Mad U-1
Mad U-1
INTRODUCTION
A Mobile application most commonly referred to as an app, is a type application software designed
to run on a mobile device such as smart phone, tablet computer.
Mobile app development is the process by which a mobile application is developed for mobile
devices like PDAs, Tablet computer or mobile phones.
Andorid is a mobile operating system developed by Google based on a modified version of Linux
kernel and open source software which is designed for touchscreen mobile devices such as smart
phones and tablets.
Most mobile applications are developed for two main smartphone platforms,
1. Android operating system
2. Apple’s iOS
Android is the world’s most popular platform for mobile devices.
For Application developers, Android is an open platform that provides exciting opportunities for
developing virtually any app imaginable.
Android applications can be packaged easily and sold out either through a store as Google play
Store, Windows Phone Store, Slide Me, Opera Mobile Store, Mobango, F-droid and the Amazon
App Store.
ANDROID
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.
Now a days, most popular used mobile operating system (OS) is Android.
Android was founded in Palo Alto of California, U.S. by Andy Rubin, Rich Miner, Nick Sears and
Chris White during 2003. After it was acquired by Google in 2005.
The Android is a powerful Operating system OS and it supports large number of applications (apps)
in smart phones. These applications are more comfortable and advanced for the users. The hardware
that supports android software is based on ARM(Advanced RISC machine) architecture platform.
The Android is an open source operating system means that it is free and any one can use it.
It is available low cost in the market
The Android development supports with the full java pragramming language.
The first beta version of the Android Software Development Kit (SDK) was released by Google in
2007 where as the first commercial version, Android 1.0, was released in September 2008.
On June 27, 2012, at the Google I/O conference, Google announced the next Android version,
4.1 Jelly Bean. Jelly Bean is an incremental update, with the primary aim of improving the user
interface, both in terms of functionality and performance.
The Open Handset Alliance (OHA) is a business alliance that was created for the purpose of
developing open mobile device standards.
In August 2005, Google formed Open Handset Alliance (OHA) in order to develop an open source
software platform for use in mobile devices.
The OHA is the group that is in charge of the Android smart phones operating system.
The OHA has approximately 80 member companies, including HTC, Dell, Intel, Motorola, LG
Electronics, Samsung, Qualcomm and Google.
The OHA’s main product is the Android platform – the world’s most popular smartphone platform.
The members of OHA include handset manufactures, chip makers, commercialization companies,
software companies and mobile operators/ users.
The goal of the open handset alliance(OHA) is to providing users with the service and applications
that they want and need.
ANDROID VERSIONS
The development of the Android operating system was started in 2003 by Android, Inc. Later on, it was
purchased by Google in 2005. The beta version of Android OS was released on November 5, 2007, while
the software development kit (SDK) was released on November 12, 2007.
The first Android mobile was publicly released with Android 1.0 of the T-Mobile G1 (aka HTC Dream) in
October 2008.
The code names of android ranges from A to N currently, such as Aestro, Blender, Cupcake, Donut,
Eclair, Froyo, Gingerbread, Honeycomb, Ice Cream Sandwitch, Jelly Bean, KitKat, Lollipop and
Marshmallow.
FEATURES OF ANDROID
Android is an open source, lightweight and powerful operating system which supports great features.
ANDROID ARCHITECTURE
Android architecture contains a different number of components to support any Android device’s
needs.
Android software contains an open-source Linux Kernel having a collection of a number of
C/C++ libraries.
The main components of Android architecture are the following:-
Applications
Application Framework
Android Runtime
Platform Libraries
Linux Kernel
1) Linux kernel
It is the heart of android architecture that exists at the root of android architecture.
Linux kernel is responsible for device drivers, power management, memory management, device
management and resource access.
2) Native Libraries
On the top of linux kernel, there are Native libraries such as WebKit, OpenGL used for 2D & 3D
Graphics, FreeType, SQLite, Media, C runtime library (libc) etc.
WebKit Library for Browser.
SQLite for Database.
FreeType for font support.
Media for playing audio and video formats.
3) Android Runtime
In android runtime, there are core libraries and DVM (Dalvik Virtual Machine) which is
responsible to run android application.
DVM is like JVM but it is optimized for mobile devices. It consumes less memory and provides
fast performance.
It consumes less memory & provides fast performance.
DVM:
4) Android Framework
On the top of Native libraries and android runtime, there is android framework.
The Application Framework layer provides many higher-level services to applications in the
form of Java classes.
Application developers are allowed to make use of these services in their applications.
Android framework includes Android API's such as UI (User Interface), telephony, resources,
locations, Content Providers (data) and package managers.
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.
5) Android Applications
Applications is the top layer of android architecture, the pre-installed applications like home,
contacts, camera, gallery etc.., and third party applications downloaded from play store like chat
applications, games etc.., will be installed on this layer only.
It runs within the Android runtime with the help of the classes and services provided by the
Application Framework.
Android Debug Bridge:
Android Debug Bridge (ADB) is a command-line tool built into Android’s SDK.
It lets you communicate with a device and perform various actions, such as installing and
debugging apps, copying files back and forth, and accessing Unix shell to run commands.
ADB is a client-server program that includes three components:
Client:
The client runs ADB commands from a shell or script on your development Machine. Its role is
to send commands to the server.
Daemon(adbd):
The ADB daemon, called adbd.
The daemon runs as a background process on your device. Its purpose is to connect with the
ADB server through USB or TCP for emulators. The ADB server considers a device “ONLINE”
when it successfully connects with the daemon.
Server:
The server runs as a background process on your development machine. Its purpose is to sense
the USB port when you attach or remove the device, maintain a list of connected devices, and
assign different states to each of them like “ONLINE”, “OFFLINE”, “BOOTLOADER” and
“RECOVERY”.
An IDE is a software development tool that is mainly used by the developers to write and test the
programs or software.
Android Studio is the official Integrated Development Environment (IDE) for Android app
development.
A mobile IDE offers a platform that combines code editing, debugging, testing, and deployment
tools, enabling developers to build mobile applications efficiently.
Features of IDE:
Properties of IDE:
Code Editor: IDEs provide a code editor with features like syntax highlighting, auto-
completion, code formatting. These features help developers write code faster and with fewer
errors.
Build Automation: IDEs automate the build process, allowing developers to compile, build, and
package their applications with ease. Build tools integrated into IDEs (such as Gradle or Maven)
Debugger: This helps in identifying and fixing bugs efficiently.
Version Control Integration: They provide tools for committing changes, viewing version
history, resolving conflicts, and merging branches directly within the IDE.
Project Management: IDEs support project management features such as project templates, file
organization, and project navigation, to visualize the project structure and manage files.
Code Templates and Snippets: IDEs provide pre-defined code templates and snippets that help
developers quickly insert commonly used code patterns and structures.
Language Support: IDEs are designed to support specific programming languages and
frameworks.
User Interface Design Tools: For platform-specific development like Android or desktop
applications, IDEs often include visual designers for creating user interfaces (UIs) using drag-
and-drop components. These tools generate XML or code for UI layout.
Error Checking and Code Analysis: IDEs perform real-time error checking and code analysis
to highlight syntax errors, potential bugs, and code style violations as developers write code.
Integration with External Services: Modern IDEs integrate with external services such as
cloud platforms (e.g., AWS, Azure), databases, and APIs.
Reformat coding.
Check matching braces.
Single step through a function.
Traverse a package hierarchy searching for all the instances of a specific string.
Helps in generating the UML diagram.
You can start your Android application development on either of the following operating systems −
Second point is that all the required tools to develop Android applications are open source and can be
downloaded from the Web.
Java JDK5 or later version
Android Studio
If you are installing Android Studio on Mac or Linux, You can download the latest version
from Android Studio Mac Download,or Android Studio Linux Download, check the instructions
provided along with the downloaded file for Mac OS and Linux.
Installation
So let's launch Android Studio.exe, Make sure before launch Android Studio, Our Machine should
required installed Java JDK.
Once you launched Android Studio, its time to mention JDK7 path or later version in android studio
installer.
Below the image initiating JDK to android SDK
Need to check the components, which are required to create applications, below the image has
selected Android Studio, Android SDK, Android Virtual Machine and performance(Intel chip).
Need to specify the location of local machine path for Android studio and Android SDK.
Need to specify the ram space for Android emulator by default it would take 512MB of local machine
RAM.
At final stage, it would extract SDK packages into our local machine, it would take a while time to
finish the task and would take 2626MB of Hard disk space.
Below are the steps to start and set up a new android project in Android Studio.
Then select the Minimum SDK to select the operating system which must be least version to run your
app, here “Jelly Bean” is made Minimum SDK, and phones and tablets with versions lower to this OS
will not be able to run your apps. Click on “Next”
The next step is to choose the Activity to mobile. Activity in Android refers to asingle screen
with a user interface. For Beginners, “Empty Activity” is recommended.
Then, fill the Activity name text field. By default, “MainActivity” is filled in this text box as the name
of your activity. In android studio, files are usually named in camel case. An xml file of the activity is
created using the first word in the Activity name. An xml file is a file to provide functionalities of user
interface for our app.
Click on “Finish”.
Then, a default app is created with all default files. And you can now start writing the application
code.
To test your Android applications, you will need a virtual Android device. So before we start
writing our code, let us create an Android virtual device. Launch Android AVD Manager Clicking
AVD_Manager icon as shown below.
After Click on a virtual device icon, it going to be shown by default virtual devices which are
present on your SDK, or else need to create a virtual device by clicking Create new Virtual
device button
If your AVD is created successfully it means your environment is ready for Android application
development.
Android Emulator
The Android emulator is an Android Virtual Device (AVD), which represents a specific
Android device.
We can use the Android emulator as a target device to execute and test our Android
application on our PC.
The Android emulator provides almost all the functionality of a real device.
We can get the incoming phone calls and text messages.
It also gives the location of the device and simulates different network speeds.
Android emulator simulates rotation and other hardware sensors. It accesses the Google
Play store, and much more.
Requirement and recommendations:
1. In Android Studio, we need to create an Android Virtual Device (AVD) that the emulator can
use to install and run your app. To create a new AVD:-
1.1 Open the AVD Manager by clicking Tools > AVD Manager.
1.2 Click on Create Virtual Device, at the bottom of the AVD Manager dialog. Then Select
Hardware page appears.
1.3 Select a hardware profile and then click Next. If we don?t see the hardware profile we want,
then we can create or import a hardware profile. The System Image page appears.
1.4 Select the system image for the particular API level and click Next. This leads to open a Verify
Configuration page.
1.5 Change AVD properties if needed, and then click Finish.
2. In the toolbar, choose the AVD, which we want to run our app from the target device from the
drop-down menu.
3. Click Run.
UI screen components
A typical user interface of an android application consists of action bar and the application content
area.
A UI is defined in an xml file. During compilation, each element in the XML is compiled into
equivalent Android GUI class with attributes represented by methods.
An activity is consist of views. A view is just a widget that appears on the screen. It could be
button e.t.c. One or more views can be grouped together into one GroupView. Example of
ViewGroup includes layouts.
Types of layout,
There are many types of layout. Some of which are listed below −
Linear Layout
Absolute Layout
Table Layout
Frame Layout
Relative Layout
Linear Layout
Linear layout is further divided into horizontal and vertical layout. It means it can arrange views in
a single column or in a single row. Here is the code of linear layout(vertical) that includes a text
view.
<TextView
android:layout_width=”fill_parent”
android:layout_height=”wrap_content”
android:text=”@string/hello” />
</LinearLayout>
Absolute Layout
The Absolute Layout enables you to specify the exact location of its children. It can be declared
like this.
<AbsoluteLayout
android:layout_width=”fill_parent”
android:layout_height=”fill_parent”
xmlns:android=”http://schemas.android.com/apk/res/android” >
<Button
android:layout_width=”188dp”
android:layout_height=”wrap_content”
android:text=”Button”
android:layout_x=”126px”
android:layout_y=”361px” />
</AbsoluteLayout>
TableLayout
The Table Layout groups views into rows and columns. It can be declared like this.
<TableLayout
xmlns:android=”http://schemas.android.com/apk/res/android”
android:layout_height=”fill_parent”
android:layout_width=”fill_parent” >
<TableRow>
<TextView
android:text=”User Name:”
android:width =”120dp”
/>
<EditText
android:id=”@+id/txtUserName”
android:width=”200dp” />
</TableRow>
</TableLayout>
Relative Layout
The Relative Layout enables you to specify how child views are positioned relative to each other.It
can be declared like this.
<RelativeLayout
android:id=”@+id/RLayout”
android:layout_width=”fill_parent”
android:layout_height=”fill_parent”
xmlns:android=”http://schemas.android.com/apk/res/android” >
</RelativeLayout>
Frame Layout
The Frame Layout is a placeholder on screen that you can use to display a single view. It can be
declared like this.
<ImageView
android:src = “@drawable/droid”
android:layout_width=”wrap_content”
android:layout_height=”wrap_content” />
</FrameLayout>
Apart form these attributes, there are other attributes that are common in all views and
ViewGroups. They are listed below −
Units of Measurement
When you are specifying the size of an element on an Android UI, you should remember the
following units of measurement.
<!-- RelativeLayout in which we set green color for the background -->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/greenColor"
tools:context=".MainActivity">
<TextView
android:id="@+id/firstTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_margin="20dp"
android:padding="10dp"
android:text="First Text View"
android:textColor="@color/white"
android:textSize="20sp"
android:textStyle="bold" />
<!-- second TextView -->
<TextView
android:id="@+id/secondTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/firstTextView"
android:layout_centerHorizontal="true"
android:layout_margin="20dp"
android:padding="10dp"
android:text="Second Text View"
android:textColor="@color/white"
android:textSize="20sp"
android:textStyle="bold" />
</RelativeLayout>
2. Manifest xml File(Mainfest.xml): This xml is used to define all the components of our application. It
includes the names of our application packages, our Activities, receivers, services and the permissions
that our application needs. For Example – Suppose we need to use internet in our app then we need to
define Internet permission in this file.
Location in Android Studio:
It is located inside app > manifests folder
</manifest>
3. Strings xml File(strings.xml): This xml file is used to replace the Hard-coded strings with a single
string. We define all the strings in this xml file and then access them in our app(Activity or in Layout
XML files) from this file. This file enhance the reusability of the code.
Location in Android Studio:
Below we show strings.xml file and define a string in the file.
<resources>
<string name="app_name">My Application</string>
4. Styles xml File(styles.xml): This xml is used to define different styles and looks for the UI(User
Interface) of application. We define our custom themes and styles in this file.
Location in Android Studio:
Below we show the style.xml file.
<resources>
</resources>
5. Drawable xml Files: These are those xml files that are used to provide various graphics to the
elements or views of application. When we need to create a custom UI we use drawable xml files.
Suppose if we need to define a gradient color in the background of Button or any custom shape for a
view then we create a Drawable xml file and set it in the background of View.
Do Read: How To Create Drawable Resource XML File in Android Studio
Below we show custom_drawable.xml file and create a gradient background color using style attribute.
6. Color xml File (colors.xml): This file is used to define the color codes that we used in our app. We
simply define the color’s in this file and used them in our app from this file.
Location in Android Studio
Below we show the colors.xml file in which we define green and white color.
7. Dimension xml File(dimens.xml): This xml file is used to define the dimensions of the View’s.
Suppose we need a Button with 50dp(density pixel) height then we define the value 50dp in dimens.xml
file and then use it in our app from this file.
Location in Android Studio:
Below we show the dimens.xml file in which we define 50dp dimension for Button height.
<resources>
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen><dimen name="btnheight">50dp</dimen>
</resources>