Mobile-Application-and-User-experience-Design-Lab
Mobile-Application-and-User-experience-Design-Lab
2. User Interfaces 37
10. Identify and Describe the Objectives for UED Experiment 269
❖❖❖❖
Mobile Application and User Experience Design Lab
Syllabus
Sr.
Module Detailed Contents Hrs
No.
1 Introduction to The android platform, the layers of android, Four kinds of 04
Android android components, understanding the android Manifest.
xml file, creating an android application Introduction to
android SDK, Exploring the development environment
2 User interfaces Creating the activity, working with views, using resources 06
Working with intents and services, Different types of
layouts, components.
3 Storing and Using the file system, working with shared preferences, 10
Retrieving data persisting data to a database, Working with content
providers
4 Graphics and Drawing graphics in android, creating animations with 06
animation, androids graphics API, Playing audio & video, Capturing
Multimedia media
5 Location, Using Location Manager and Location Provider, working 04
Sensors with maps, Working with GPS, Bluetooth and Wi-Fi,
Integrating Google maps, services for push notification
Google ads.
6 REST API Using Async Task to perform network operations, 08
integration introduction to Htttp Url Connection and JSON,
performing network operations asynchronously, working
with Ok Http, Retrofit and Volley
7 Database SQLite Programming, Android database connectivity 08
connectivity and using SQLite , distribution options, packaging and testing
distributing the application, distributing applications on Google play
android application store
1.1
INTRODUCTION TO ANDROID PART-I
Unit Structure
1.1.0 Objectives
1.1.1 Introduction
1.1.2 An Overview Android
1.1.2.1 Why android?
1.1.2.2 The android platform
1.1.2.3 Four kinds of android components.
1.1.2.4 Understanding the androidManifest.xml file.
1.1.3 Summary
1.1.4 Exercise
1.1.5 List of References
1.1.0 OBJECTIVES
After going through this unit, you will be able to:
● Introduction of Android.
● Why android?
● Features of Android
● Android Architecture
● Advantages and Disadvantages of Android
● Future scope and importance of Android
● Applications of Android Challenges of Android Development
● How to kick start with android easily?
● The android platform
● Four kinds of android components.
● Understanding the androidManifest.xml file.
1
Mobile Application and 1.1.1 INTRODUCTION
User experience Design Lab
Android is an open-source operating system based on Linux with a Java
programming interface for mobile devices such as Smartphone (Touch
Screen Devices who supports Android OS) as well for Tablets too.
Android was developed by the Open Handset Alliance (OHA), which is
led by Google. The Open Handset Alliance (OHA) is a consortium of
multiple companies like Samsung, Sony, Intel and many more to provide
services and deploy handsets using the android platform.
1.1.2 AN OVERVIEW
1.1.2.1 Why android?
Android itself being widely used across the world makes it essential for
developers to choose android. There are other operating systems such as
IOS, Ti zen, etc. Most Apple smart phones use IOS as their mobile
operating system. Most of the smart phones available in the market use
Android as their operating system, making it available to more users.
It is not just why android is so essential, but several Android features
make android quite valuable for the current scenario.
Prerequisites of Android
There are not many prerequisites to start with Android Development.
However, before starting with android development, you should make sure
that you have gone through the following requirements. The prerequisites
can be listed as follows:
1. Java/Kotlin: You should have a basic knowledge of either Java or
Kotlin.
2. Database: If you have some knowledge of SQL and SQLite, then it’s
pretty good.
3. XML: A basic knowledge of XML is required.
4. OOP: Knowing the Object-Oriented Programming(OOP’s) concepts
would be an add-on and help you during app development.
Features of Android :
1. Most of the users in the world use android smart phones :
As discussed before, around 72% of the total users use android.
Moreover, this percentage may even rise in the coming years.
Considering this fact, it becomes essential for any company to develop
applications that are supported on android.
2
2. Interactive User Interface and efficient user experience : Introduction to Android Part I
Android provides exciting widgets and tools to make your creativity
and imagination turn into reality. Android developers keep on adding
exciting features and widgets to make the user interface quite
interactive and smooth. You can use these tools to make your design
and then publish that design.
Android Architecture :
Any Operating System has its architecture to carry on various
functionalities. Similarly, android has its architecture. The android
architecture gives us an idea about its design and the build. The
architecture can be subdivided into further categories as below:
1. Linux Kernel
2. Libraries
3. Android Runtime
4. Application Framework
5. Applications
3
Mobile Application and 1. Linux Kernel :
User experience Design Lab
Linux Kernel carries all the drivers for the low-level devices like Audio
Driver, Wi-Fi Driver, Flash Memory Driver, Bluetooth driver, Camera
Driver, Keypad Driver, etc. It is also the abstract layer of android.
2. Libraries :
There are several libraries to provide various functionality for purposes
like android development. These libraries are written in C/C++ and are
an essential part of architecture.
3. Android Runtime :
It provides us with an environment for executing and debugging our
android applications.
4. Application Framework :
It has many packages in it which are implemented in Java.
5. Applications :
At the top level of the architecture, you have the applications.
Applications can be of system or user or even kept by the OEM
manufacturers. Phone, Messaging, Camera, Gallery, etc., are some of
the standard applications present in any android device.
Advantages of Android
There are a lot of advantages of Android, and the following are some of
them:
1. Community Support :
Google being the developer and supporter of Android, always provides
necessary community support and has discussion forums to clear
issues.
3. Fragment Support :
Android has fragments using which we need not create multiple
activities. Using one single activity, we can perform several tasks.
One such example is Whatsapp, where we see a single activity
containing a trio of Chats, Status, and Calls.
6. Immense Support :
Almost all devices can support Android as an operating system.
7. Multitasking :
Android enables multitasking for the users.
Disadvantages of Android
There are few disadvantages related to android that can be listed as
follows:
1. Low Security :
Often, we see android apps getting breached or hacked and people’s
data getting leaked. However, at its best, Google is always coming up
with security patches and resolving such issues.
2. Testing :
Sometimes, testing an android app is ridiculous as its performance or
state may vary from device to device and even at different Android
versions.
3. Power Consumption :
Android as an operating system consumes more power.
4. Lost Tracks :
With the coming up of new android versions, it becomes pretty
challenging to adapt yourself to new Android SDK tools.
5. Restrictions :
Sometimes, there are restrictions on developers to follow the new
standards for their existing applications. Failing to do so makes your
existing app depreciated.
Applications of Android
You would be discussing various types of applications related to android.
Android helps us to make our life easier and simpler. There are multiple
kinds of applications solving numerous varieties of issues. Whether it’s
navigation, messaging, lifestyle, social media, weather, finance, food
ordering, travel, games, etc.
5
Mobile Application and Some of the most common applications are as follows:
User experience Design Lab
1. Navigation :
You have apps like Google Maps, which help us locate ourselves and
find a route to visit the desired location.
2. Lifestyle :
You have apps like Cult. Fit and Step Set Go helps you track your
fitness, how many calories you are burning, and how many walking
steps you are walking daily.
3. Messaging :
There are apps like Whats app, Telegram, etc., which help us message
any individual or a group of people together.
4. Travel :
You have apps like Make My Trip, Red Bus, etc., making our travel
booking, hotel book, or other amenities very easy and at our fingertips.
1. Security :
While developing an app, you should ensure that both user and system
data are secure on the user’s device.
2. Compatibility :
You should develop an app that can work on most Android versions.
Not all people have the latest versions of Android running on their
devices; hence making a supportive app would help you target a more
significant user section.
3. Performance :
You should always try to develop an app that is responsive and doesn’t
lag. Many users don’t have high-performance devices with greater
RAM or memory space. So you should make sure that your app doesn’t
occupy much memory and doesn’t create many junks.
6
4. Screen Variants : Introduction to Android Part I
Your app should be adaptive enough to adapt to any screen size or
resolution. Some people may run your app on their tablets or their
wide-screen smart phones. So your app should fit into those screen
variants.
5. Comments :
You should always try to comment on your codes and work so that if
anyone wants to add any feature in your application in the future, then
they can easily understand what changes they need to make and where.
8
The basic components of an Android application are: Introduction to Android Part I
1. Activities :
An activity is a class that is considered as an entry point for users that
represents a single screen. A messenger application might have an
activity that shows a new notification, another activity which reads
messages and another which composes a new message.
Each activity is independent of one another. For example – camera
application can be started in an email application to compose an email that
shares an image. The picture below depicts how each new activity adds an
item to back stack and how the current activity is destroyed and previous
activity is resumed.
To implement an activity, extend the Activity class in your subclass:
public class Main Activity extends Activity {
//code
}
2. Services :
A service is a component that runs in the background, it acts as an
invisible worker of our application. It keeps updating data sources and
activities. It also broadcasts intents and performs tasks when
applications are not active. An example of service is we can surf the
internet or use any other application while listening to music.
To execute services, extend the Services class in your sub-class:
public class My Service extends Services {
//code
}
3. Content Providers :
Content Provider is a component that allows applications to share data
among multiple applications. It hides the details of the database and can
be used to read and write private data of the application which is not
9
Mobile Application and shared. It would be a mess to access data from other applications
User experience Design Lab without content providers.
For example – you can consider looking for contact details in contact list.
Or You might want photos from the gallery which are also provided by
Content Provider.
To implement this, extend Content Provider in your subclass:
public class Provider _Name extends Content Provider {
//code
}
4. Broadcast Receiver :
Broadcast Receiver is a component that responds to broadcast messages
from another application or the same system. It can also deliver
broadcasts to applications that are not running. For example – notify
the user that the battery is low. Android developers can use broadcast
messages in the application or outside the normal flow.
To implement this, extend Broadcast Receiver to your receiver:
public class Broadcast _Name extends Broadcast Receiver {
//code
}
2. Widgets :
Widgets are variations of Broadcast Receivers and essential aspects
of home screen customization. They display data and allow users to
perform actions on them. There are various types of widgets:
● Information widget: These widgets display crucial information and
track how the information changes over time. Example – Clock widgets
and widgets that display weather and time information.
● Collection widget: As the name depicts, collection widgets are a
collection of information of the same type. Its use is for browsing
information and opening any one of the elements to view details.
10
Example – music widgets, as we can skip pause and play music outside Introduction to Android Part I
the music application.
● Control widget: These widgets display functionalities and by using
them, the user can trigger from home screen without opening the
application. Example – pause and play the video outside the
application.
● Hybrid widget: These widgets combine features of all the other three
widgets. Example – music player widget is a control widget but it also
informs the user about which track is playing currently, which means it
is a combination of control and information thus it is termed as hybrid
widget.
3. Views
View is responsible for drawing and event handling. They are
rectangular elements on the screen. Some of the views are Edit Text,
Image View Button, Check Box and Image Button.
4. Notifications
It alerts users when the application is not visible or is inactive. This
alert flashes on the screen and then disappears. Example – Notification
of the new incoming message popped on the screen.
5. Fragments
A fragment is a portion of the total user interface. Users can combine
more than one fragment in a single activity and these fragments can be
reused in multiple activities. A fragment generally contains Views
and View Groups inside them.
8. Resources
Resources in Android is for defining Images, texts, string values.
Everything is defined in the resource file and it can be referenced
within the source code. We will learn about Android Resources, in
detail in our next upcoming article on Resources.
11
Mobile Application and 1.1.2.4 Understanding the androidManifest.xml file.
User experience Design Lab AndroidManifest.xml file in android
The AndroidManifest.xml file contains information of your package,
including components of the application such as activities, services,
broadcast receivers, content providers etc.
It performs some other tasks also:
It is responsible to protect the application to access any protected parts
by providing the permissions.
It also declares the android api that the application is going to use.
It lists the instrumentation classes. The instrumentation classes provides
profiling and other informations. These informations are removed just
before the application is published etc.
This is the required xml file for all the android application and located
inside the root directory.
A simple AndroidManifest.xml file looks like this:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.javatpoint.hello"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="15" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/title_activity_main" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category
android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
12
Elements of the AndroidManifest.xml file Introduction to Android Part I
The elements used in the above xml file are described below.
<manifest>
manifest is the root element of the AndroidManifest.xml file. It
has package attribute that describes the package name of the activity
class.
<application>
application is the subelement of the manifest. It includes the namespace
declaration. This element contains several subelements that declares the
application component such as activity etc.
The commonly used attributes are of this element
are icon, label, theme etc.
android:icon represents the icon for all the android application
components.
android:label works as the default label for all the application
components.
android:theme represents a common theme for all the android activities.
<activity>
activity is the subelement of application and represents an activity that
must be defined in the AndroidManifest.xml file. It has many attributes
such as label, name, theme, launchMode etc.
android:label represents a label i.e. displayed on the screen.
android:name represents a name for the activity class. It is required
attribute.
<intent-filter>
intent-filter is the sub-element of activity that describes the type of intent
to which activity, service or broadcast receiver can respond to.
<action>
It adds an action for the intent-filter. The intent-filter must have at least
one action element.
<category>
It adds a category name to an intent-filter.
1.1.3 SUMMARY
In this Introduction to Android Part I chapter, you learned about the Why
android?, Features of Android, Android Architecture Advantages and
Disadvantages of Android, Future scope and importance of Android,
Applications of Android ,Challenges of Android Development, How to
start with android easily?, The android platform, kinds of android
components we studied basic Android’s Application components and
some additional components used for android application development.
13
Mobile Application and Also, we tried to explain each application component clearly ,
User experience Design Lab Understanding the androidManifest.xml file how and where to use it.
Along with that, you saw terminologies of Android Architecture. Still,
you had a doubt go through references and bibliography. In next chapter
Introduction to Android SDK Part II, we will learn about Android SDK .
1.1.4 EXERCISE
1) Explain Why android?
2) Explain Features of Android.
3) Explain Android Architecture
4) Write Advantages and Disadvantages of Android.
5) Write Future scope and importance of Android.
6) Write Applications of Android Challenges of Android Development
7) Explain how to kick start with android easily?
8) Explain the android platform.
9) Explain Four kinds of android components.
10) Explain androidManifest.xml file.
1.1.5 LIST REFERENCES
1) www.tutlane.com/tutorial/android/android-introduction
2) https://www.javatpoint.com/android-tutorial
3) www.tutorialspoint.com/android/android_overview.htm
4) https://techvidvan.com/tutorials/android-introduction/
5) https://www.sciencedirect.com/topics/computer-science/android-
platform
6) https://developer.android.com/codelabs/build-your-first-android-app#1
7) https://data-flair.training/blogs/android-application-components/
14
1.2
INTRODUCTION TO ANDROID SDK
PART II
Unit Structure
1.2.0 Objectives
1.2.1 Introduction
1.2.2 An Overview Android SDK
1.2.2.1 Introduction to android SDK
1.2.2.2 Exploring the development environment
1.2.2.3 Creating an android application
1.2.3 Summary
1.2.4 Exercise
1.2.5 List of References
1.2.0 OBJECTIVES
After going through this unit, you will be able to:
● Introduction of android SDK
● What is the Android SDK?
● Android SDK Features
● SDK Platform
● How to Install the Android SDK?
● What Are the Components of the Android SDK?
● Exploring the development environment
● Creating an android application
1.2.1 INTRODUCTION
Android SDK is a software development kit developed by Google for the
Android platform. The Android SDK allows you to create Android apps,
and you don't need to be an expert to use it. In this tutorial, I'll explain
what the Android SDK is and how to get started with it.
15
Mobile Application and Android SDK comes bundled with Android Studio, Google's official
User experience Design Lab integrated development environment (IDE) for the Android operating
system
● Offline Mapping :
SDK helps in dynamically downloading the maps for more than 190
countries in over 60 languages. You can view these offline. Also
dealing with the map styles and the touch gesture. This SDK also has
the ability to render raster tiles and map objects interleaved within
different map layers.
16
● Dynamic Markers : Introduction to Android SDK
Part II
In the previous versions, you could not have moved the position
without a fallback or re-adding the icon. But in the lastest edition, you
can update the position of the icon dynamically.
● Improvised API compatibility :
With the latest release, it is much easier to migrate from the Google
Maps Android API. This is another added advantage of using Android
SDK in your program.
If you already have Android Studio open, the SDK Manager icon is found
on the top right corner, as shown below.
17
Mobile Application and Install the required Android SDK platform packages and developer tools.
User experience Design Lab A good start is to install:
Android SDK Build-Tools
Android Emulator
Android SDK Platform-Tools
Android SDK Tools
Documentation for Android SDK
Click Apply, and Android Studio will install the selected tools and
packages.
All that is required to follow the instructions provided, and the updates
will be immediately downloaded to your environment.
18
What Are the Components of the Android SDK? Introduction to Android SDK
Part II
The Android SDK consists of an emulator, development tools, sample
projects with source code, and the required libraries to build Android
applications. Let's look at the key components one by one.
SDK Platform-Tools
Android Platform-Tools are used to support the features for the current
Android platform and are necessary for Android app development. These
tools interface with the Android platform on the device you use for testing.
They include:
Android Debug Bridge (adb): This is a handy command-line tool that lets
you communicate with a device. The adb command allows you to perform
device actions, such as installing and debugging apps. It also provides
access to a Unix shell that you can use to run a variety of commands on a
device.
fastboot: This lets you flash a device with a new system image.
systrace: This tool helps collect and inspect timing information across all
processes running on your device at the system level. It's crucial for
debugging app performance.
SDK Platform-Tools are backward compatible, so you need only one
version of the SDK Platform-Tools.
SDK Platform
For each version of Android, there's one SDK Platform available. These
are numbered according to the Android version (e.g. Android 7 Nougat)
and an API version (e.g. API Level 24). Before you build an Android app,
you must specify an SDK Platform as your build target. Newer SDK
Platform versions have more features for developers, but older devices
may not be compatible with the newer platform versions.
19
Mobile Application and Google APIs
User experience Design Lab
Google provides a number of exclusive Google APIs to make developing
your app easier. They also offer a system image for the emulator so you
can test your app using the Google APIs.
Android Emulator
The Android Emulator is a QEMU-based device-emulation tool that
simulates Android devices on your computer, allowing developers to test
applications on different devices and Android API levels, without needing
to have physical devices for each. The emulator comes with configurations
for various Android phones, tablets, Wear OS, and Android TV devices.
The Android emulator provides almost all of the capabilities of a real
Android device. You can perform the following activities:
simulate phone calls and text messages
simulate different network speeds
specify the location of the device
simulate hardware sensors such as rotation
access Google Play Store and much more
Often it is faster and easier to test your app with an emulator instead of
using a physical device.
Install Android
System Requirements
System requirements for Windows, Mac OS and Linux are given below.
Windows - Microsoft® Windows® 7/8/10 (32- or 64-bit)
3 GB RAM minimum, 8 GB RAM recommended; plus 1 GB for the
Android Emulator
2 GB of available disk space minimum,
4 GB Recommended (500 MB for IDE + 1.5 GB for Android SDK and
emulator system image)
1280 x 800 minimum screen resolution
For accelerated emulator: 64-bit operating system and Intel® processor
with support for Intel® VT-x, Intel® EM64T (Intel® 64), and Execute
Disable (XD) Bit functionality
Mac - Mac® OS X® 10.10 (Yosemite) or higher, up to 10.12 (macOS
Sierra)
20
3 GB RAM minimum, 8 GB RAM recommended; plus 1 GB for the Introduction to Android SDK
Android Emulator 2 GB of available disk space minimum Part II
Installation
Android supports java, c++, c# etc. language to develop android
applications. Java is the officially supported language for android. All the
android examples of this site is developed using Java language and Eclipse
IDE.
Here, we are going to tell you, the required softwares to develop android
applications using Eclipse IDE.
There are two ways to install android.
1. By ADT Bundle
2. By Setup Eclipse Manually
22
4) Download the ADT plugin for eclipse Introduction to Android SDK
Part II
ADT (Android Development Tools) is required for developing the android
application in the eclipse IDE. It is the plugin for Eclipse IDE that is
designed to provide the integrated environment.
For downloading the ADT, you need to follow these steps:
1) Start the eclipse IDE, then select Help > Install new software...
2) In the work with combo box, write https://dl-
ssl.google.com/android/eclipse/
24
To create this simplest Android app, just follow along with the steps in Introduction to Android SDK
this tutorial. Part II
25
Mobile Application and An activity is a crucial component of any Android app. It provides a
User experience Design Lab screen with which users can interact to perform activities, such as making
a phone call, taking a photo, or sending a message. Each Activity has a
window in which to draw its user interface. The window typically fills the
screen, but it may be smaller than the screen and float on top of other
windows.
26
Whenever you start a new project, Android Studio creates the necessary Introduction to Android SDK
folder structure and files for that app. Let's look at the different files Part II
involved in an Android app project.
27
Mobile Application and The Default Main Activity
User experience Design Lab
The main activity is the first screen that will appear when you launch your
app.
Each Activity represents a screen of the Android app's user interface. Each
Activity has a Java (or Kotlin) implementation file and an XML layout
file.
You don't need to understand this code fully. A lot of it is boilerplate and
will be the same for any app. The code defines a Main Activity class and,
along with the on Create method, defines what happens when the Activity
is created. In this case, it simply initializes the view of the Activity with
the layout from the activity _main layout file.
28
Introduction to Android SDK
Activity.xml Part II
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:
android="https://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: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>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
android:textSize="50dp"
android:textColor="#800000"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
The Strings File
The strings.xml file provides text strings for your application. For
example, a default strings file looks like this:
29
Mobile Application and STRINGS
User experience Design Lab <resources>
<string name="app_name">Hello World
Application</string>
</resources>
If you want to change your app name, you can do it here.
30
Introduction to Android SDK
Part II
31
Mobile Application and
User experience Design Lab
33
Mobile Application and import android.widget.Button;
User experience Design Lab
import android.widget.EditText;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
private EditText edittext1, edittext2;
private Button buttonSum;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
addListenerOnButton();
}
public void addListenerOnButton() {
edittext1 = (EditText) findViewById(R.id.editText1);
edittext2 = (EditText) findViewById(R.id.editText2);
buttonSum = (Button) findViewById(R.id.button);
buttonSum.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String value1=edittext1.getText().toString();
String value2=edittext2.getText().toString();
int a=Integer.parseInt(value1);
int b=Integer.parseInt(value2);
int sum=a+b;
Toast.makeText(getApplicationContext(),String.valueOf(sum),
Toast.LENGTH_LONG).show();
}
});
}
}
34
Output: Introduction to Android SDK
Part II
1.2.3 SUMMARY
In this Introduction to Android SDK II chapter, you learned about the
Introduction of android SDK , What is the Android SDK? Android SDK
Features, SDK Platform, How to Install the Android SDK?, What Are the
Components of the Android SDK?, Exploring the development
environment, Creating an android application. Along with that, you saw
terminologies of Android Architecture. Still, you had a doubt go through
references and bibliography.
1.2.4 EXERCISE
1) Write Introduction of android SDK.
2) What is the Android SDK?
3) Explain Android SDK Features.
4) Explain SDK Platform.
5) How to Install the Android SDK?
6) What Are the Components of the Android SDK?
7) Exploring the development environment.
8) Create an simple android application.
9) Create an User interface android application.
35
Mobile Application and 1.2.5 LIST OF REFERENCES
User experience Design Lab
1) www.tutlane.com
2) https://www.javatpoint.com
3) www.tutorialspoint.com
4) https://techvidvan.com
5) https://www.sciencedirect.com
6) https://developer.android.com
7) https://code.tutsplus.com
8) https://data-flair.training
36
Module:2
2
USER INTERFACES
Unit Structure :
2.1 Practical 1
2.1.1 Aim
2.1.2 Objective
2.1.3 Theory
2.1.4 Program 1: Activity
2.1.4.1 Output
2.1.5 Program 2: Intent and its type
2.1.5.1 Output
2.2 Practical 2 (Views and types of layouts)
2.2.1 Aim
2.2.2 Objective
2.2.3 Theory
2.2.4 Program 1: View and Linear Layout
2.2.4.1 Output
2.2.5 Program 2: Relative Layout
2.2.5.1 Output
2.3 Questions
2.1.2 Objective:
The objective of this practical is to understand the concept of activity,
resources and different types of intent.
37
Mobile Application and 2.1.3 Theory:
User experience Design Lab
Activity
● An activity represents a single screen with a user interface just like
window or frame of Java.
● Android activity is the subclass of Context Theme Wrapper class.
● Activity class is one of the very important parts of the Android
component.
● Any app whether it is small or big, it has at least one Activity class.
● An activity is the entry point for interacting with the user.
● Every activity contains the layout, which has a user interface to
interact with the user.
● As we know that every activity contains a layout associated with it,
so it can be said that activity class is the gateway, through which a
user can interact programmatically with UI.
● The 7-lifecycle method of Activity describes below:
Methods Description
On Create called when activity is first created.
On Start called when activity is becoming visible to the user.
On Resume called when activity will start interacting with the
user.
On Pause called when activity is not visible to the user.
On Stop called when activity is no longer visible to the user.
On Restart called after your activity is stopped, prior to start.
On Destroy called before the activity is destroyed.
Android Resources
● We must take care of various resources like static content that we
use in our code such as bitmaps, colors, layout definitions, user
interface strings, animation instructions, and more.
● These resources are always maintained separately in various sub-
directories under res/ directory of the project.
38
User Interfaces
Intent
● Android uses Intent for communicating between the components of
an application and also from one application to another application.
● Intent are the objects which is used in android for passing the
information among Activities in an application and from one app to
another also.
● Intent is used for communicating between the Application
components and it also provides the connectivity between two apps.
● For example: Intent provides you to redirect your activity to another
activity on occurrence of any event. By calling, start Activity() you
can perform this task.
Types of Intent
Explicit Intent:
• Explicit Intents are used to connect the application internally.
• Explicit Intent work internally within an application to perform
navigation and data transfer.
Implicit Intent:
● In Implicit Intents we do need to specify the name of the component.
We just specify the Action which has to be performed and further this
action is handled by the component of another application.
● The basic example of implicit Intent is to open any web page.
39
Mobile Application and 2.1.4 Program 1: Activity
User experience Design Lab
Program to demonstrate the life cycle of Activity.
1) To create your new Android project, click on Create New Project on
the Welcome to Android Studio window.
2) If you have a project already opened, select File > New > New Project.
5) Click on finish.
MainActivity.java
package com.example.activitylifecycle;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Log.d("lifecycle","onCreate invoked");
41
Mobile Application and
User experience Design Lab Toast.makeText(MainActivity.this,"Created",Toast.LENGTH_SHORT).s
how();
}
@Override
protected void onStart() {
super.onStart();
Log.d("lifecycle","onStart invoked");
Toast.makeText(MainActivity.this,"Start",Toast.LENGTH_SHORT).sho
w();
}
@Override
protected void onResume() {
super.onResume();
Log.d("lifecycle","onResume invoked");
Toast.makeText(MainActivity.this,"Resume",Toast.LENGTH_SHORT).s
how();
}
@Override
protected void onPause() {
super.onPause();
Log.d("lifecycle","onPause invoked");
Toast.makeText(MainActivity.this,"Pause",Toast.LENGTH_SHORT).sho
w();
}
@Override
protected void onStop() {
super.onStop();
Log.d("lifecycle","onStop invoked");
42
User Interfaces
Toast.makeText(MainActivity.this,"Stop",Toast.LENGTH_SHORT).show
();
}
@Override
protected void onRestart() {
super.onRestart();
Log.d("lifecycle","onRestart invoked");
Toast.makeText(MainActivity.this,"Restart",Toast.LENGTH_SHORT).sh
ow();
}
@Override
protected void onDestroy() {
super.onDestroy();
Log.d("lifecycle","onDestroy invoked");
Toast.makeText(MainActivity.this,"Destroy",Toast.LENGTH_SHORT).s
how();
}
}
2.1.4.1 Output:
43
Mobile Application and on Create, on Start and on Resume methods are invoked.
User experience Design Lab
44
User Interfaces
45
Mobile Application and xmlns:app="http://schemas.android.com/apk/res-auto"
User experience Design Lab
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_marginRight="50dp"
android:layout_marginLeft="50dp"
tools:ignore="RtlHardcoded">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Intent Example"
android:layout_marginTop="40dp"
android:layout_marginBottom="30dp"
android:textAlignment="center"
android:textColor="@color/black"
android:textSize="30sp"
tools:ignore="SpUsage" />
<Button
android:id="@+id/button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Explicit Intent Example"
android:layout_marginTop="40dp"
android:layout_marginBottom="30dp"/>
46
<Button User Interfaces
android:id="@+id/button2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Implicit Intent Example"
android:layout_marginTop="40dp"
android:layout_marginBottom="30dp"/>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
Component Tree
47
Mobile Application and Code for MainActivity.java
User experience Design Lab
package com.example.intentexample;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.content.Intent;
import android.net.Uri;
public class MainActivity extends AppCompatActivity {
Button explicit_btn, implicit_btn;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
explicit_btn = (Button)findViewById(R.id.button);
implicit_btn = (Button) findViewById(R.id.button2);
//implement Onclick event for Explicit Intent
explicit_btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(getBaseContext(),
MainActivity2.class);
startActivity(intent);
}
});
//implement onClick event for Implicit Intent
implicit_btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent1 = new Intent(Intent.ACTION_VIEW);
48
intent1.setData(Uri.parse("https://www.wikipedia.org/")); User Interfaces
startActivity(intent1);
}
});
}
}
49
Mobile Application and Component Tree
User experience Design Lab
Activity_main.xml in design
mode
50
protected void onCreate(Bundle savedInstanceState) { User Interfaces
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main2);
}
}
2.1.5.1 Output:
When we click on Explicit Intent example button we will get the following
output:
51
Mobile Application and When we click on Implicit Intent example button, we will get the
User experience Design Lab following output:
2.2.2 Objective:
The objective of this module is to understand the different types of views
available in android and also learn the importance of different layout.
2.2.3 Theory:
Android Views and View Groups
● All the interaction of a user with the Android application is through the
user interface (UI).
● Actually, an android application comprises combination and nesting of
Views-Group and Views Classes.
Views
● View is the basic building block of UI (User Interface) in android.
View refers to the android. view. View class, which is the super class
for all the GUI components like Text View, Image View, Button etc.
52
● It is a small rectangular box that can be Text View, Edit Text, or even a User Interfaces
button. It occupies the area on the screen in a rectangular area and is
responsible for drawing and event handling.
● View is a super class of all the graphical user interface components.
● Here we have some of the most commonly used android View classes:
Text View
Edit Text
Button
Image View
Image Button
Check Box
Radio Button
List View
Grid View
Date Picker
Spinner, etc
View Group
● A View Group is a subclass of the View Class and can be considered as
a super class of Layouts.
● It provides an invisible container to hold the views or layouts.
● View Group instances and views work together as a container for
Layouts.
● In other words we can say that View Group is a special view that can
hold other views that are often known as a child view.
● Following are certain commonly used subclasses for View Group:
Linear Layout
Relative Layout
Frame Layout
Grid View
List View
53
Mobile Application and The relation between View and view Group is shown in the below figure:
User experience Design Lab
Android Layout
● Layout basically refers to the arrangement of elements on a page and
these elements are likely to be images, texts or styles.
● These are a part of Android Jetpack. They define the structure of
android user interface in the app, like in an activity.
● All elements in the layout are built with the help of Views and View
Groups.
● These layouts can have various widgets like buttons, labels, textboxes,
and many others.
Relative Layout :
● This layout is for specifying the position of the elements in relation to
the other elements that are present there.
54
● In the relative layout, alignment of the position of the elements to the User Interfaces
parent container is possible.
● To define it in such a way, we write the following:
android:layout_alignParentTop= “true”
android:layout_alignParentLeft= “true”
● If we write the above code, the element will get aligned on the top left
of the parent container.
● If we want to align it with some other element in the same container, it
can be defined is as follows:
android:layout_alignLeft= “@+id/element_name”
android:layout_below= “@+id/element_name”
● This will align the element below the other element to its left.
55
Mobile Application and 4) In the Configure your project window, complete the following:
User experience Design Lab
● Enter "View Example" in the Name field.
● Enter "com. example. View Example" in the Package name field.
● If you'd like to place the project in a different folder, change
its Save location.
● Select either Java or Kotlin from the Language drop-down menu.
● Select the lowest version of Android you want your app to support in
the Minimum SDK field.
● If your app will require legacy library support, mark the Use legacy
android.support libraries checkbox.
● Leave the other option as it is.
5) Click on finish.
In this program we are going to use the following controls:
1. Image View
2. Text(Plain Text)
3. Text (E Mail)
4. Text (Phone)
5. Text View
6. Three Check Box
7. Radio Group with three Radio Button
8. Button
And we have used Linear Layout(Vertical) and linear Layout (Horizontal)
for arranging the various views.
56
tools:context=".MainActivity"> User Interfaces
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp">
<ImageView
android:id="@+id/imageView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:srcCompat="@drawable/register"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"/>
<EditText
android:id="@+id/editTextTextPersonName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:hint="Enter Your Name"
android:inputType="textPersonName"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"/>
<EditText
android:id="@+id/editTextTextEmailAddress"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:hint="Enter Your Email"
57
Mobile Application and android:inputType="textEmailAddress"
User experience Design Lab
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"/>
<EditText
android:id="@+id/editTextPhone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:hint="Enter Your Phone Number"
android:inputType="phone"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:orientation="horizontal">
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Gender" />
<RadioGroup
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<RadioButton
android:id="@+id/radioButton"
58
android:layout_width="wrap_content" User Interfaces
android:layout_height="wrap_content"
android:text="Male" />
<RadioButton
android:id="@+id/radioButton2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Female" />
<RadioButton
android:id="@+id/radioButton3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Other" />
</RadioGroup>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp">
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Education" />
<CheckBox
android:id="@+id/checkBox"
android:layout_width="wrap_content"
59
Mobile Application and android:layout_height="wrap_content"
User experience Design Lab
android:text="HSC" />
<CheckBox
android:id="@+id/checkBox2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Graduation" />
<CheckBox
android:id="@+id/checkBox3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="PostGraduation" />
</LinearLayout>
<Button
android:id="@+id/button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Submit" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
Component Tree
60
Activity_main.xml in design mode User Interfaces
Note: In this program we are only designing user interface and not
providing any functionality to it. That is why, writing java files is not
required.
As in this practical we have use Image View Control so for that first we
have to add image in drawable folder. Then that image will be displayed
on the Image View Control.
MainActivity.java (This is auto generated code, we can add our code as
per our program in this file)
package com.example.viewexample;
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);
}
}
61
Mobile Application and 2.2.4.1 Output:
User experience Design Lab
62
xmlns:app="http://schemas.android.com/apk/res-auto" User Interfaces
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintTop_toTopOf="parent"
tools:layout_editor_absoluteX="43dp">
<EditText
android:id="@+id/editTextTextPersonName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/editTextTextPassword"
android:layout_alignParentStart="true"
android:layout_alignParentEnd="true"
android:layout_marginStart="99dp"
android:layout_marginEnd="103dp"
android:layout_marginBottom="56dp"
android:ems="10"
android:hint="Enter your User Name"
android:inputType="textPersonName" />
<EditText
android:id="@+id/editTextTextPassword"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/button"
android:layout_alignParentStart="true"
63
Mobile Application and android:layout_alignParentEnd="true"
User experience Design Lab
android:layout_marginStart="105dp"
android:layout_marginEnd="96dp"
android:layout_marginBottom="56dp"
android:ems="10"
android:hint="Enter Your Password"
android:inputType="textPassword" />
<Button
android:id="@+id/button"
android:layout_width="157dp"
android:layout_height="wrap_content"
android:layout_above="@+id/textView"
android:layout_alignParentStart="true"
android:layout_alignParentEnd="true"
android:layout_marginStart="127dp"
android:layout_marginEnd="127dp"
android:layout_marginBottom="32dp"
android:text="Login" />
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="37dp"
android:layout_alignParentStart="true"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:layout_marginStart="98dp"
android:layout_marginEnd="104dp"
android:layout_marginBottom="299dp"
android:text="Not Registered? Register Here" />
64
</RelativeLayout> User Interfaces
</androidx.constraintlayout.widget.ConstraintLayout>
Component Tree
65
Mobile Application and Note: In this program we are only designing user interface and not
User experience Design Lab providing any functionality to it. That is why, writing java files is not
required.
MainActivity.java (This is auto generated code, we can add our code as
per our program in this file)
package com.example.relativelayoutexample;
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);
}
}
2.2.5.1 Output:
66
2.3 QUESTIONS User Interfaces
67
3
STORING AND RETRIEVING DATA
Unit Structure
3.0 File System
3.0.1 Introduction
3.0.2 Android File System Hierarchy Explained
3.0.3 How to access The Roots Files In Android
3.1 Android – Shared Preferences
3.1.1 Introduction
3.1.2 Mode & description
3.2 Definition of Persistence
3.0.1 Introduction
Most people know that the file system structure of Android devices
shares some obvious similarities with Linux since it is a framework that
is built on top of the Linux kernel. However, the Android file system
structure does have some traits which are unique. Let’s explore the
Android File system hierarchy together.
Nevertheless, the thing that is common between them is that it lacks the
concept of drives or directories as you see in Windows. Instead, it uses
partitions in a single directory, sort of like a single tree with multiple
branches. Certain partitions of the file system can be explored by
using file managers, which lets you bring some semblance of order to
your files. This is especially useful since sometimes it can feel that
Android completely ignores conventional file storage practices, with
users often ending up with a massive jumbled mess of files.
Additionally, each partition has a certain function as well. So, let’s
explore the Android file system hierarchy in depth.
Table of Contents
3.0.2 Android File System Hierarchy Explained:
● /boot
● /system
● /recovery
68
● /data Storing And Retrieving Data
● /cache
● /misc
● /sdcard
● /sd-ext
/boot
This partition consists of the Android kernel and the ram disk. Basically,
every single thing that is needed to boot your Android device when
powered on. You should only proceed to wipe this partition from
recovery if it is absolutely necessary. If you do, once the partition is
wiped, ensure to reboot the phone only after installing a new boot
partition. The new partition can be a /boot partition found in a ROM.
/system
The system partition accommodates the entire Android OS. This includes
the Android GUI as well as the system apps that come pre-installed on
Android devices. So, what happens if you wipe this partition? Well, you
can still boot the device. We will only be able to put our device into
recovery or boot loader mode.
/recovery
This partition is designed for backup and can be considered the
alternative boot option or partition in an Android device. It lets the
device boot into recovery mode where backing up data, wiping data,
restoring phone to factory settings, and performing other maintenance
operations.
/data
Also known as user data partition, this partition consists of all of the
user’s data, including contacts, settings, apps and messages. Wiping the
data partition will lead to storing your phone to factory settings, having
removed all of the apps, messages, and user settings from the Android
device.
69
Mobile Application and /cache
User experience Design Lab
This partition stores the frequently accessed app data and components.
Wiping this partition will just clear the built-up cache, and the device
will simply go back to rebuilding it as you continue using it. Clearing
cache also frees up some space in your device and can also fix certain
issues at times.
/misc
This partition contains all the miscellaneous system settings, usually
on/off switches. The settings may include carrier or region ID, USB
configuration, and certain hardware setting. This partition is very
important since it can cause several device features to malfunction if the
partition becomes corrupt or goes missing. A missing /misc partition can
also cause the Android device to not boot at all.
/sdcard
This partition is the space that is available to users to store their files and
data. Depending on your device, you could even have more than one SD
card partition. If your device has an external SD card slot, then the / SD
card partition refers to the internal storage device, and the external SD
card will be assigned a different partition, either a new partition called
/sdcard2 or a separate directory within the / SD card partition itself such
as / SD card/sd. Wiping the partition with the external SID card storage is
completely safe, as long as you have backed up any important data or
documents you may have on it. Wiping the / SD card partition with the
external SD and storage is completely safe, as long as you have backed
up any important data or documents you may have on it. Wiping the / SD
card partition, however, results in wiping some system and app data and
settings, but it still doesn’t hinder the system’s boot processor
functionality.
/sd-ext
This is an additional partition of the SD card partition, which is only
present on some devices, typically ones that have custom ROMS or mods
on them. It can usually be used with certain ROMS that have special
features such as APP2SD+ or data2ext enabled. This is essentially a /data
partition of the / SD card and stores some user data and settings that are
typically stored on the /data partition. This is useful for devices with
limited internal memory.
Without rooting your device, Android users typically can only access the
data partition. The contents of this partition are what you will see in most
file managers or when you connect it to a PC. If you have an external SD
card attached to the device, you will also be able to view the contents of
it in this user-accessible data partition. If your phone doesn’t come
packing a decent file explorer or manager, you can simply install one of
the powerful third-party file manager available on the Play Store. You
can also browse your data files on PC via a USB connection. However,
70
ensure that your phone is in MTP (Media Transfer) or File Transfer Storing And Retrieving Data
mode.
Android also divides its storage into three distinct categories, which is
quite different from a PC’s file system layout. Here is how it divides its
storage: Device storage – This refers to the pool of storage you can work
with and access. You can even modify files in this storage area. Portable
SD card storage – This storage area is allocated to external SD cards.
You can load files into this and then insert them into your device. Device
root storage – Every Android device has a special file system where all
the root files are stored. This includes operating system files, sensitive
application data, system apps, and more. Users typically cannot modify
this file system for security and device safety reasons unless, of course,
they have root access.
In the most basic sense, ‘root’ refers to the topmost folder in the Android
file system. This would be the equivalent to the c:\ drive on Windows.
Unlike Windows, though, Android has built an invisible barrier about
halfway up the file system tree and only allows you to access certain files
before you hit this virtual wall, beyond which the root files lie. This is to
stop users from making irreversible or irreparable changes to critical OS
files.
71
Mobile Application and 3.1 ANDROID - SHARED PREFERENCES
User experience Design Lab
3.1.1 Introduction
Android provides many ways of storing data of an application. One of
this way is called Shared Preferences. Shared Preferences allow you to
save and retrieve data in the form of key, value pair.
In order to use shared preferences, you have to call a method get Shared
Preferences() that returns a Shared Preference instance pointing to the
file that contains the values of preferences.
Shared Preferences sharedpreferences =
getSharedPreferences(MyPREFERENCES, Context.MODE_PRIVATE);
The first parameter is the key and the second parameter is the MODE.
Apart from private there are other modes available that are listed below –
1 MODE_APPEND
This will append the new preferences with the already existing
preferences
2 MODE_ENABLE_WRITE_AHEAD_LOGGING
Database open flag. When it is set , it would enable write ahead
logging by default
3 MODE_MULTI_PROCESS
This method will check for modification of preferences even if the
shared preference instance has already been loaded
4 MODE_PRIVATE
By setting this mode, the file can only be accessed using calling
application
5 MODE_WORLD_READABLE
This mode allow other application to read the preferences
6 MODE_WORLD_WRITEABLE
This mode allow other application to write the preferences
1 apply()
It is an abstract method. It will commit your changes back from
editor to the shared Preference object you are calling
2 clear()
It will remove all values from the editor
3 remove(String key)
It will remove the value whose key has been passed as a
parameter
73
Mobile Application and Example
User experience Design Lab
Steps Description
package com.example.sairamkrishna.myapplication;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
EditText ed1,ed2,ed3;
Button b1;
public static final String MyPREFERENCES = "MyPrefs" ;
public static final String Name = "nameKey";
public static final String Phone = "phoneKey";
public static final String Email = "emailKey";
SharedPreferences sharedpreferences;
@Override
74
protected void onCreate(Bundle savedInstanceState) { Storing And Retrieving Data
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ed1=(EditText)findViewById(R.id.editText);
ed2=(EditText)findViewById(R.id.editText2);
ed3=(EditText)findViewById(R.id.editText3);
b1=(Button)findViewById(R.id.button);
sharedpreferences = getSharedPreferences(MyPREFERENCES,
Context.MODE_PRIVATE);
b1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String n = ed1.getText().toString();
String ph = ed2.getText().toString();
String e = ed3.getText().toString();
SharedPreferences.Editor editor = sharedpreferences.edit();
editor.putString(Name, n);
editor.putString(Phone, ph);
editor.putString(Email, e);
editor.commit();
Toast.makeText(MainActivity.this,"Thanks",Toast.LENGTH_LONG).sh
ow();
}
});
}
}
75
Mobile Application and Following is the content of the modified main activity
User experience Design Lab fileres/layout/activiy_main.xml.
76
<EditText Storing And Retrieving Data
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/editText"
android:layout_below="@+id/textView2"
android:layout_marginTop="67dp"
android:hint="Name"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/editText2"
android:layout_below="@+id/editText"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:hint="Pass" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/editText3"
android:layout_below="@+id/editText2"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentRight="true"
77
Mobile Application and android:layout_alignParentEnd="true"
User experience Design Lab
android:hint="Email" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Save"
android:id="@+id/button"
android:layout_below="@+id/editText3"
android:layout_centerHorizontal="true"
android:layout_marginTop="50dp" />
</RelativeLayout>
<resources>
<string name="app_name">My Application</string>
</resources>
78
<intent-filter> Storing And Retrieving Data
</manifest>
Let's try to run your application. I assume you have connected your
actual Android Mobile device with your computer. To run the app from
Android studio, open one of your project's activity files and click
Run icon from the toolbar. Before starting your application, Android
studio will display following window to select an option where you want
to run your Android application.
Select your mobile device as an option and then check your mobile
device which will display following screen −
Now just put in some text in the field. Like i put some random name and
other information and click on save button.
79
Mobile Application and
User experience Design Lab
Now when you press save button, the text will be saved in the shared
preferences. Now press back button and exit the application. Now open it
again and you will see all the text you have written back in your
application.
80
storage, including a hard disk, is used instead of volatile memory like Storing And Retrieving Data
RAM.
For example, imagine that you're using the Chrome browser on the
Windows operating system and, due to some technical issues, the
browser process was shut down or killed. The browser restarts the next
time you open it and attempts to reopen any tabs that were open when it
crashed. A persistent process thus exists even if it failed or was killed for
some technical reasons. The persistent state is the state that remains even
after a process shuts down. Persistent process states are stored in
persistent storage (non-volatile storage like hard drives) before the
system fails or shuts down. They're easily retrieved once the system is
turned on. The core processes of the operating system must be persistent
for maintaining the data, device, or workspace in a similar state when the
system is switched on.
Types of Persistence
There are two types of persistence: object persistence and process
persistence. In data terms, object persistence refers to an object that is
not deleted until a need emerges to remove it from the memory. Some
database models provide mechanisms for storing persistent data in the
form of objects. In process persistence, processes are not killed or shut
down by other processes and exist until the user kills them. For example,
all of the core processes of a computer system are persistent for enabling
the proper functioning of the system. Persistent processes are stored in
non-volatile memory. They do not need special databases like persistent
objects.
81
Mobile Application and 3. Persistent data cannot be deleted by external processes or objects until
User experience Design Lab the user deletes it, meaning it's stable.
4. Persistent data is time independent data. The data created by an
application or object continues to exist even after the parent
application or object has been deleted and remains accessible beyond
object boundaries, other processes, or transactions.
5. Persistent data remains in its original format. If data resides in volatile
memory, it's deleted once the process is closed. However, persistent
data stored in persistent databases, or non-volatile storage, continues
to reside there even after closing the program.
6. Persistent data is non-volatile in nature and can withstand power
outages.
7. Persistent data is recoverable data even after a system restarts or shuts
down.
8. Persistent data changes cannot be lost and will always be available for
access.
82
Storing And Retrieving Data
Content URI
Content URI(Uniform Resource Identifier) is the key concept of
Content providers. To access the data from a content provider, URI is
used as a query string.
Structure of a Content
URI: content://authority/optionalPath/optionalID
84
Following are the six abstract methods and their description which are Storing And Retrieving Data
essential to override as the part of ContenProvider class:
Abstract
Method Description
Example
The prime purpose of a content provider is to serve as a central
repository of data where users can store and can fetch the data. The
access of this repository is given to other applications also but in a safe
manner in order to serve the different requirements of the user. The
following are the steps involved in implementing a content provider. In
this content provider, the user can store the name of persons and can
fetch the stored data. Moreover, another application can also access the
stored data and can display the data.
85
Mobile Application and Note: Following steps are performed on Android Studio version 3.0
User experience Design Lab
Creating a Content Provider:
Step 1: Create a new project
1. Click on File, then New => New Project.
2. Select language as Java/Kotlin.
3. Choose empty activity as a template
4. Select the minimum SDK as per your need.
● XML
<resources>
<string name="app_name">Content_Provider_In_Android</string>
<string name="hintText">Enter User Name</string>
<string name="heading">Content Provider In Android</string>
<string name="insertButtontext">Insert Data</string>
<string name="loadButtonText">Load Data</string>
</resources>
86
● Java Storing And Retrieving Data
● Kotlin
package com.example.contentprovidersinandroid;
import android.content.ContentProvider;
import android.content.ContentUris;
import android.content.ContentValues;
import android.content.Context;
import android.content.UriMatcher;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteException;
import android.database.sqlite.SQLiteOpenHelper;
import android.database.sqlite.SQLiteQueryBuilder;
import android.net.Uri;
import java.util.HashMap;
public class MyContentProvider extends ContentProvider {
public MyContentProvider() {
}
// defining authority so that other application can access it
static final String PROVIDER_NAME =
"com.demo.user.provider";
// defining content URI
static final String URL = "content://" + PROVIDER_NAME +
"/users";
// parsing the content URI
static final Uri CONTENT_URI = Uri.parse(URL);
static final String id = "id";
static final String name = "name";
static final int uriCode = 1;
static final UriMatcher uriMatcher;
private static HashMap<String, String> values;
static {
// to match the content URI
// every time user access table under content provider
uriMatcher = new UriMatcher(UriMatcher.NO_MATCH);
// to access whole table
uriMatcher.addURI(PROVIDER_NAME, "users", uriCode);
// to access a particular row
// of the table
uriMatcher.addURI(PROVIDER_NAME, "users/*", uriCode);
87
Mobile Application and }
User experience Design Lab @Override
public String getType(Uri uri) {
switch (uriMatcher.match(uri)) {
case uriCode:
return "vnd.android.cursor.dir/users";
default:
throw new IllegalArgumentException("Unsupported URI: " +
uri);
}
}
// creating the database
@Override
public boolean onCreate() {
Context context = getContext();
DatabaseHelper dbHelper = new DatabaseHelper(context);
db = dbHelper.getWritableDatabase();
if (db != null) {
return true;
}
return false;
}
@Override
public Cursor query(Uri uri, String[] projection, String selection,
String[] selectionArgs, String sortOrder) {
SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
qb.setTables(TABLE_NAME);
switch (uriMatcher.match(uri)) {
case uriCode:
qb.setProjectionMap(values);
break;
default:
throw new IllegalArgumentException("Unknown URI " + uri);
}
if (sortOrder == null || sortOrder == "") {
sortOrder = id;
}
Cursor c = qb.query(db, projection, selection, selectionArgs, null,
null, sortOrder);
c.setNotificationUri(getContext().getContentResolver(), uri);
return c;
88
} Storing And Retrieving Data
// adding data to the database
@Override
public Uri insert(Uri uri, ContentValues values) {
long rowID = db.insert(TABLE_NAME, "", values);
if (rowID > 0) {
Uri _uri = ContentUris.withAppendedId(CONTENT_URI,
rowID);
getContext().getContentResolver().notifyChange(_uri, null);
return _uri;
}
throw new SQLiteException("Failed to add a record into " + uri);
}
@Override
public int update(Uri uri, ContentValues values, String selection,
String[] selectionArgs) {
int count = 0;
switch (uriMatcher.match(uri)) {
case uriCode:
count = db.update(TABLE_NAME, values, selection,
selectionArgs);
break;
default:
throw new IllegalArgumentException("Unknown URI " + uri);
}
getContext().getContentResolver().notifyChange(uri, null);
return count;
}
@Override
public int delete(Uri uri, String selection, String[] selectionArgs) {
int count = 0;
switch (uriMatcher.match(uri)) {
case uriCode:
count = db.delete(TABLE_NAME, selection, selectionArgs);
break;
default:
throw new IllegalArgumentException("Unknown URI " + uri);
}
getContext().getContentResolver().notifyChange(uri, null);
return count;
}
// creating object of database
89
Mobile Application and // to perform query
User experience Design Lab private SQLiteDatabase db;
// declaring name of the database
static final String DATABASE_NAME = "UserDB";
// declaring table name of the database
static final String TABLE_NAME = "Users";
// declaring version of the database
static final int DATABASE_VERSION = 1;
// sql query to create the table
static final String CREATE_DB_TABLE = " CREATE TABLE " +
TABLE_NAME
+ " (id INTEGER PRIMARY KEY AUTOINCREMENT, "
+ " name TEXT NOT NULL);";
// creating a database
private static class DatabaseHelper extends SQLiteOpenHelper {
// defining a constructor
DatabaseHelper(Context context) {
super(context, DATABASE_NAME, null,
DATABASE_VERSION);
}
// creating a table in the database
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL(CREATE_DB_TABLE);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int
newVersion) {
// sql query to drop a table
// having similar name
db.execSQL("DROP TABLE IF EXISTS " + TABLE_NAME);
onCreate(db);
}
}
}
90
● XML Storing And Retrieving Data
android:layout_marginBottom="40dp"
android:fontFamily="@font/roboto"
android:hint="@string/hintText" />
<Button
android:id="@+id/insertButton"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="20dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="20dp"
android:layout_marginBottom="20dp"
android:background="#4CAF50"
android:fontFamily="@font/roboto"
android:onClick="onClickAddDetails"
android:text="@string/insertButtontext"
android:textAlignment="center"
android:textAppearance="@style/TextAppearance.AppCompat.D
isplay1"
android:textColor="#FFFFFF"
android:textStyle="bold" />
<Button
android:id="@+id/loadButton"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="20dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="20dp"
android:layout_marginBottom="20dp"
android:background="#4CAF50"
android:fontFamily="@font/roboto"
android:onClick="onClickShowDetails"
android:text="@string/loadButtonText"
android:textAlignment="center"
android:textAppearance="@style/TextAppearance.AppCompat.D
isplay1"
android:textColor="#FFFFFF"
android:textStyle="bold" />
<TextView
android:id="@+id/res"
android:layout_width="match_parent"
91
Mobile Application and android:layout_height="wrap_content"
User experience Design Lab android:layout_marginStart="20dp"
android:layout_marginEnd="20dp"
android:clickable="false"
android:ems="10"
android:fontFamily="@font/roboto"
android:textColor="@android:color/holo_green_dark"
android:textSize="18sp"
android:textStyle="bold" />
</LinearLayout>
<ImageView
android:id="@+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:srcCompat="@drawable/banner" />
</androidx.constraintlayout.widget.ConstraintLayout>
● Java
● Kotlin
package com.example.contentprovidersinandroid;
import androidx.appcompat.app.AppCompatActivity;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
92
public class MainActivity extends AppCompatActivity { Storing And Retrieving Data
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
@Override
public boolean onTouchEvent(MotionEvent event) {
InputMethodManager imm =
(InputMethodManager)getSystemService(Context.INPUT_METHO
D_SERVICE);
imm.hideSoftInputFromWindow(getCurrentFocus().getWindow
Token(), 0);
return true;
}
public void onClickAddDetails(View view) {
// class to add values in the database
ContentValues values = new ContentValues();
// fetching text from user
values.put(MyContentProvider.name, ((EditText)
findViewById(R.id.textName)).getText().toString());
// inserting into database through content URI
getContentResolver().insert(MyContentProvider.CONTENT_U
RI, values);
// displaying a toast message
Toast.makeText(getBaseContext(), "New Record Inserted",
Toast.LENGTH_LONG).show();
}
public void onClickShowDetails(View view) {
// inserting complete table details in this text field
TextView resultView= (TextView) findViewById(R.id.res);
● XML
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.content_provider_in_android">
<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">
<provider
android:name="com.example.contentprovidersinandroid.MyCont
entProvider"
android:authorities="com.demo.user.provider"
android:enabled="true"
android:exported="true"></provider>
<activity android:name=".MainActivity">
94
<intent-filter> Storing And Retrieving Data
<action android:name="android.intent.action.MAIN" />
</manifest>
● XML
<resources>
<string name="app_name">Accessing_Content_Provider</string>
<string name="heading">Accessing data of Content Provider</string>
<string name="loadButtonText">Load Data</string>
</resources>
● XML
<?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"
95
Mobile Application and android:layout_width="match_parent"
User experience Design Lab
android:layout_height="match_parent"
android:background="#168BC34A"
tools:context=".MainActivity">
<LinearLayout
android:id="@+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:orientation="vertical"
app:layout_constraintBottom_toTopOf="@+id/imageView"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.13"
tools:ignore="MissingConstraints">
<TextView
android:id="@+id/textView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:layout_marginBottom="70dp"
android:fontFamily="@font/roboto"
android:text="@string/heading"
android:textAlignment="center"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
android:textColor="@android:color/holo_green_dark"
android:textSize="36sp"
android:textStyle="bold" />
96
<Button Storing And Retrieving Data
android:id="@+id/loadButton"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="20dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="20dp"
android:layout_marginBottom="20dp"
android:background="#4CAF50"
android:fontFamily="@font/roboto"
android:onClick="onClickShowDetails"
android:text="@string/loadButtonText"
android:textAlignment="center"
android:textAppearance="@style/TextAppearance.AppCompat.
Display1"
android:textColor="#FFFFFF"
android:textStyle="bold" />
<TextView
android:id="@+id/res"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginEnd="20dp"
android:clickable="false"
android:ems="10"
android:fontFamily="@font/roboto"
android:textColor="@android:color/holo_green_dark"
android:textSize="18sp"
android:textStyle="bold" />
97
Mobile Application and </LinearLayout>
User experience Design Lab
<ImageView
android:id="@+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:srcCompat="@drawable/banner" />
</androidx.constraintlayout.widget.ConstraintLayout>
● Java
● Kotlin
package com.example.accessingcontentprovider;
import androidx.appcompat.app.AppCompatActivity;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
Uri CONTENT_URI =
Uri.parse("content://com.demo.user.provider/users");
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
98
} Storing And Retrieving Data
public void onClickShowDetails(View view) {
// inserting complete table details in this text field
TextView resultView= (TextView) findViewById(R.id.res);
// creating a cursor object of the
// content URI
Cursor cursor =
getContentResolver().query(Uri.parse("content://com.demo.user.provider
/users"), null, null, null, null);
// iteration of the cursor
// to print whole table
if(cursor.moveToFirst()) {
StringBuilder strBuild=new StringBuilder();
while (!cursor.isAfterLast()) {
strBuild.append("\n"+cursor.getString(cursor.getColumnIndex(
"id"))+ "-"+ cursor.getString(cursor.getColumnIndex("name")));
cursor.moveToNext();
}
resultView.setText(strBuild);
}
else {
resultView.setText("No Records Found");
}
}
}
99
4
GRAPHICS, ANIMATION AND
MULTIMEDIA
Unit Structure
4.0 Objectives
4.1 Introduction
4.2 Summary
4.3 References
4.4 Unit End Exercises
4.0 OBJECTIVE
One of the main goals and objectives of a graphic designer is to design a
project based on the individual needs of a client. Prior to beginning
the design phase of a project, a graphic designer speaks with a client to
determine a project's overall goal, purpose and desired appearance.
The biggest use for animation is for entertainment. Animation is used
on the TV, on your phones, and all over the internet. In television,
animation is mostly used to occupy children, as is gives them something
to laugh about and keep them entertained for long periods of time.
Multimedia introduces how multimedia can be used in various
application areas. It provides a solid foundation to the students so that
they can identify the proper applications of multimedia, evaluate the
appropriate multimedia systems and develop effective multimedia
applications.
4.1 INTRODUCTION
Drawing graphics in android
It is the use of computers to create and manipulate pictures on a display
device. It comprises of software techniques to create, store, modify,
represents pictures.
100
be represented in pictorial form. A picture can be understood easily just Graphics, Animation and
with a single look. Multimedia
Output
103
Mobile Application and Definition of Animation :
User experience Design Lab
Animation is the process of creating an illusion of motion and shape
change by means of rapid display of various type of pictures that were
made to create a single scene.
Principles of Animation :
8. Secondary action :
As with one character’s action second character move shows the
multiple dimension of an animation.
9. Timing :
For playing a given action a perfect timing is very important.
104
10. Exaggeration : Graphics, Animation and
This principle creates extra reality in the scene by developing a Multimedia
proper animation style.
11. Solid drawing :
In this principle, any object will created into 3D form to get realistic
visualization of scene.
12. Appeal :
Any character need not be as same as any real character but it somewhat
seems to be like that which create a proper thinking in the audience’s
mind.
Write a program in C for bouncing ball animation using graphics.h
header file
In this program, we will draw a red color ball move it vertically up and
down like a bouncing ball. We will use below mentioned functions in
this program.
Function Description
Set fill It sets the current fill pattern and fill color.
style
Flood fill It is used to fill a closed area with current fill pattern and
fill color. It takes any point inside closed area and color of
the boundary as input.
Clear It clears the screen, and sets current position to (0, 0).
device
105
Mobile Application and Delay It is used to suspend execution of a program for a M
User experience Design Lab milliseconds.
Close It unloads the graphics drivers and sets the screen back to
graph text mode.
Program Output
Here is the screenshot of bouncing
ball.
Configuring DevC++
● Step 1: Download the DevC++ version 5.11.
● Step 2: Download the Graphics header files, and etc stuff.
● Step 3: Extract the contents of the rar file.
● Step 4: Go to the location where DevC++ is installed. For me its D
drive. Go inside the MinGW64 folder. Copy the graphics.h and
winbgim.h in the include folder and D:\Dev-Cpp\MinGW64\x86_64-
w64-mingw32\include folder.
● Step 5:Copy the libbgi.a file into lib folder and in D:\Dev-
Cpp\MinGW64\x86_64-w64-mingw32\lib folder.
● Step 6: Copy the ConsoleAppGraphics.template,
ConsoleApp_cpp_graph.txt files and paste them inside the template
folder of the devc++ installer location.
Now we are done with configuring of the DevC++ to support graphics
programming. We shall write our very first graphics program now.
108
12. closegraph(); Graphics, Animation and
Multimedia
13. getch();
14. }
Go to “Project” menu and choose “Project Options” (or just press
ALT+P).
Go to the “Parameters” tab In the “Linker” field, enter the following text:
-lbgi
-lgdi32
-lcomdlg32
-luuid
-loleaut32
-lole32
Click OK and Compile and run the project and you’ll get this output:
4.2 SUMMARY
Computer graphics is receiving much attention in the development of
interactive educational software, multimedia systems, and many other
applications. It not only adds a new dimension to such applications but
109
Mobile Application and also makes them more exciting and dynamic. Furthermore, the use of
User experience Design Lab computer graphics is already well accepted in computer science
education. If skillfully and relevantly used, it can be an important
component of computer-assisted instruction, which is an educational
application area with tremendous potential.
4.3 REFERENCES
● Animation for Beginners
Basic Principles of Animation for Motion Graphics
(Lisa Lee)
110
5
LOCATION AND SENSORS
Unit Structure
5.0 Objective
5.1 Introduction
5.2 Summary
5.3 References
5.4 Unit End Exercises
5.0 OBJECTIVE
The main purpose of location-based applications is to broadcast your
current location coordinates to local businesses. The technology that
uses radio waves to identify individual items is: QR codes can only store
information that is comprised of numbers or text.
The sensor is a device that detects and majors the changes in the
nearby environment and sends that data to the operating system or
processor. They sense and collects data for which they are made. Like
ambient light, the sensor is made for detecting light, so it is an expert in
detecting the light.
5.1 INTRODUCTION
Sensors can be used to monitor the three-dimensional device
movement or change in the environment of the device. Android
provides sensor API to work with different types of sensors.
A data class representing a geographic location. A location consists of
a latitude, longitude, timestamp, accuracy, and other information such as
bearing, altitude and velocity.
First, create a Location Manager object by calling the get System
Service() method and LOCATION_SERVICE as an argument. Call get
Best Provider() to get the location in the form of a string. Now the
provider to the get Last Known Location() as an argument to get the
location. Finally, get the latitude and longitude by calling the get
Latitude() and get Longitude() methods.
111
Mobile Application and Step 1
User experience Design Lab
Create an XML file and write this:
1. <RelativeLayout xmlns:android="http://schemas.android.com/apk/r
es/android"
2. xmlns:tools="http://schemas.android.com/tools"
3. android:layout_width="match_parent"
4. android:layout_height="match_parent"
5. android:paddingLeft="@dimen/activity_horizontal_margin"
6. android:paddingRight="@dimen/activity_horizontal_margin"
7. android:paddingTop="@dimen/activity_vertical_margin"
8. android:paddingBottom="@dimen/activity_vertical_margin"
9. tools:context=".MainActivity">
10.
11. <TextView
12. android:id="@+id/textview1"
13. android:layout_width="wrap_content"
14. android:layout_height="wrap_content"
15. android:text="@string/hello_world" />
16. <TextView
17. android:id="@+id/textview2"
18. android:layout_width="wrap_content"
19. android:layout_height="wrap_content"
20. android:layout_marginTop="30dp" />
21. <TextView
22. android:id="@+id/textview3"
23. android:layout_width="wrap_content"
24. android:layout_height="wrap_content"
25. android:layout_marginTop="60dp" />
26. </RelativeLayout>
112
Step 2 Location and Sensors
First, create a Location Manager object by calling the get System
Service() method and LOCATION_SERVICE as an argument. Call get
Best Provider() to get the location in the form of a string. Now the
provider to get Last Known Location() as an argument to get the
location. Finally, get the latitude and longitude by calling the get
Latitude() and get Longitude() methods.
Create a Java file and write this:
1. package com.currentlocation;
2. import android.content.Context;
3. import android.location.Criteria;
4. import android.location.Location;
5. import android.location.LocationListener;
6. import android.location.LocationManager;
7. import android.os.Bundle;
8. import android.app.Activity;
9. import android.view.Menu;
10. import android.widget.TextView;
11. import android.widget.Toast;
12.
13. public class MainActivity extends Activity implements LocationL
istener {
14.
15. LocationManager locationmanager;
16. @Override
17. protected void onCreate(Bundle savedInstanceState) {
18. super.onCreate(savedInstanceState);
19. setContentView(R.layout.activity_main);
20.
21. locationmanager=(LocationManager)getSystemService(Context.L
OCATION_SERVICE);
22. Criteria cri=new Criteria();
113
Mobile Application and 23. String provider=locationmanager.getBestProvider(cri,false);
User experience Design Lab
24.
25. if(provider!=null & !provider.equals(""))
26. {
27. Location location=locationmanager.getLastKnownLocation
(provider);
28. locationmanager.requestLocationUpdates(provider,2000,1,this);
29. if(location!=null)
30. {
31. onLocationChanged(location);
32. }
33. else{
34. Toast.makeText(getApplicationContext(),"location not foun
d",Toast.LENGTH_LONG ).show();
35. }
36. }
37. else
38. {
39. Toast.makeText(getApplicationContext(),"Provider is null",To
ast.LENGTH_LONG).show();
40. }
41. }
42. @Override
43. public boolean onCreateOptionsMenu(Menu menu) {
44. // Inflate the menu; this adds items to the action bar if it is pres
ent.
45. getMenuInflater().inflate(R.menu.main, menu);
46. return true;
47. }
48. @Override
114
49. public void onLocationChanged(Location location) { Location and Sensors
50. TextView textView2=(TextView)findViewById(R.id.textview2);
51.
52. TextView textView3=(TextView)findViewById(R.id.textview3);
53.
54. textView2.setText("Latitude"+location.getLatitude());
55. textView3.setText("Longitude"+ location.getLongitude());
56. }
57. @Override
58. public void onStatusChanged(String s, int i, Bundle bundle) {
59. }
60. @Override
61. public void onProviderEnabled(String s) {
62. }
63. @Override
64. public void onProviderDisabled(String s) {
65. }
66. }
Step 3
Perform the following changes in the Android Manifest.xml file:
1. <?xml version="1.0" encoding="utf-8"?>
2. <manifest xmlns:android="http://schemas.android.com/apk/res/andr
oid"
3. package="com.currentlocation"
4. android:versionCode="1"
5. android:versionName="1.0" >
6. <uses-
permission android:name="android.permission.INTERNET"></use
s-permission>
115
Mobile Application and 7. <uses-
User experience Design Lab permission android:name="android.permission.ACCESS_FINE_L
OCATION"></uses-permission>
8. <uses-sdk
9. android:minSdkVersion="7"
10. android:targetSdkVersion="16" />
11. <application
12. android:allowBackup="true"
13. android:icon="@drawable/ic_launcher"
14. android:label="@string/app_name"
15. android:theme="@style/AppTheme" >
16. <activity
17. android:name="com.currentlocation.MainActivity"
18. android:label="@string/app_name" >
19. <intent-filter>
20. <action android:name="android.intent.action.MAIN" />
21. <category android:name="android.intent.category.
LAUNCHER" />
22. </intent-filter>
23. </activity>
24. </application>
25. </manifest>
116
Step 4 Location and Sensors
Set latitude and longitude in Android Studio DDMS to run the
application on the emulator as in the following:
Step 5
117
Mobile Application and Step 2 − Add the following code to res/layout/activity_main.xml.
User experience Design Lab
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
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:gravity="center"
android:layout_height="match_parent"
tools:context=".MainActivity">
<TextView
android:id="@+id/text"
android:textSize="30sp"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
In the above code, we have taken a text view to show the current
network location provider.
Step 3 − Add the following code to src/MainActivity.java
package com.example.myapplication;
import android.Manifest;
import android.content.pm.PackageManager;
import android.location.Address;
import android.location.Geocoder;
import android.location.Location;
import android.location.LocationManager;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.RequiresApi;
import android.support.v4.app.ActivityCompat;
118
import android.support.v7.app.AppCompatActivity; Location and Sensors
import android.widget.TextView;
import java.io.IOException;
import java.util.List;
public class MainActivity extends AppCompatActivity {
TextView textView;
Location location;
double describeContents;
List<Address> addresses;
Geocoder geocoder;
@RequiresApi(api = Build.VERSION_CODES.P)
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
textView = findViewById(R.id.text);
LocationManager locationManager = (LocationManager)
this.getSystemService(LOCATION_SERVICE);
if (ActivityCompat.checkSelfPermission(this,
Manifest.permission.ACCESS_FINE_LOCATION) !=
PackageManager.PERMISSION_GRANTED &&
ActivityCompat.checkSelfPermission(this,
Manifest.permission.ACCESS_COARSE_LOCATION) !=
PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this, new
String[]{Manifest.permission.ACCESS_FINE_LOCATION,
Manifest.permission.ACCESS_COARSE_LOCATION}, 101);
}
location = locationManager
.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
geocoder= new Geocoder(this);
}
119
Mobile Application and
User experience Design Lab
@RequiresApi(api = Build.VERSION_CODES.O)
@Override
public void onRequestPermissionsResult(int requestCode, String[]
permissions, int[] grantResults) {
switch (requestCode) {
case 101:
if (grantResults[0] ==
PackageManager.PERMISSION_GRANTED) {
if (ActivityCompat.checkSelfPermission(this,
Manifest.permission.ACCESS_FINE_LOCATION) !=
PackageManager.PERMISSION_GRANTED &&
ActivityCompat.checkSelfPermission(this,
Manifest.permission.ACCESS_COARSE_LOCATION) !=
PackageManager.PERMISSION_GRANTED) {
return;
}
textView.setText("" + location.getProvider());
} else {
//not granted
}
break;
default:
super.onRequestPermissionsResult(requestCode, permissions,
grantResults);
}
}
@RequiresApi(api = Build.VERSION_CODES.O)
@Override
protected void onResume() {
super.onResume();
if (ActivityCompat.checkSelfPermission(this,
Manifest.permission.ACCESS_FINE_LOCATION) !=
120
PackageManager.PERMISSION_GRANTED && Location and Sensors
ActivityCompat.checkSelfPermission(this,
Manifest.permission.ACCESS_COARSE_LOCATION) !=
PackageManager.PERMISSION_GRANTED) {
return;
}
textView.setText("" + location.getProvider());
}
}
Let's try to run your application. I assume you have connected your
actual Android Mobile device with your computer. To run the app from
android studio, open one of your project's activity files and click
Run icon from the toolbar. Select your mobile device as an option and
then check your mobile device which will display your default screen −
122
● contains Value: Returns true if the map contains the requested value. Location and Sensors
● equals: Compares an Object with the map for equality.
● get: Retrieve the value of the requested key.
● entry Set: Returns a Set view of the mappings contained in this map.
● key Set: Returns a Set that contains all keys of the map.
● put: Adds the requested key-value pair in the map.
● remove: Removes the requested key and its value from the map, if the
key exists.
● size: Returns the number of key-value pairs currently in the map.
Examples of Map
There are many classes that implement the Java Map interface. In this
chapter, we will present the most common and used.
Hash Map
The most common class that implements the Map interface is the
Java Hash Map. A Hash Map is a hash table-based implementation of the
Map interface. It permits null keys and values. Also, this class does not
maintain any order among its elements and especially, it does not
guarantee that the order will remain constant over time. Finally,
a HashMap contains two fundamental parameters: initial capacity and
performance. The capacity is defined as the number of buckets in the
hash table, while the load factor is a measure that indicates the maximum
value the hash table can reach, before being automatically increased.
A simple example that uses a Hash Map is shown below:
HashMapExample.java:
package jcg.zheng.demo.data;
01
02
import java.util.HashMap;
03
import java.util.Map;
04
05
public class HashMapExample {
06
07
public static void main(String[] args) {
08
Map<String, Integer> vehicles = new HashMap<>();
09
10
123
Mobile Application and // Add some vehicles.
User experience Design Lab 11 vehicles.put("BMW", 5);
12 vehicles.put("Mercedes", 3);
13 vehicles.put("Audi", 4);
14 vehicles.put("Ford", 10);
15
16 System.out.println("Total vehicles: " + vehicles.size());
17
18 // Iterate over all vehicles, using the keySet method.
19 for (String key : vehicles.keySet())
20 System.out.println(key + " - " + vehicles.get(key));
21 System.out.println();
22
23 String searchKey = "Audi";
24 if (vehicles.containsKey(searchKey))
25 System.out.println("Found total " +
26 vehicles.get(searchKey) + " " + searchKey + " cars!\n");
27
28 // Clear all values.
29 vehicles.clear();
30
31 // Equals to zero.
32 System.out.println("After clear operation, size: " +
33 vehicles.size());
34 }
}
A sample execution is shown below:
1 Total vehicles: 4
2 Audi - 4
3 Ford - 10
4 BMW - 5
5 Mercedes - 3
6
7 Found total 4 Audi cars!
8
9 After clear operation, size: 0
Hash Table
The Hash Table class implements a hash table and maps keys to values.
However, neither the key nor the value can be null. This class contains
two fundamental parameters: initial capacity and performance, with the
same definitions as the Hash Map class.
124
A simple example that uses a Hash Table is shown below: Location and Sensors
HashTableExample.java:
package jcg.zheng.demo.data;
01
import java.util.Hashtable;
02
import java.util.Map;
03
04
public class HashTableExample {
05
public static void main(String[] args) {
06
Map<String, Integer> vehicles = new Hashtable<>();
07
08
// Add some vehicles.
09
vehicles.put("BMW", 5);
10
vehicles.put("Mercedes", 3);
11
vehicles.put("Audi", 4);
12
vehicles.put("Ford", 10);
13
14
System.out.println("Total vehicles: " + vehicles.size());
15
16
// Iterate over all vehicles, using the keySet method.
17
18
for (String key : vehicles.keySet())
19
System.out.println(key + " - " + vehicles.get(key));
20
System.out.println();
21
22
String searchKey = "Audi";
23
if (vehicles.containsKey(searchKey))
24
System.out.println("Found total " + vehicles.get(searchKey)
25
+ " " + searchKey + " cars!\n");
26
27
// Clear all values.
28
vehicles.clear();
29
30
// Equals to zero.
31
System.out.println("After clear operation, size: " +
32
vehicles.size());
33
// The next statements throw a NullPointerException, if
34
uncommented.
35
// vehicles.put("Nissan", null);
36
// vehicles.put(null, 6);
37
}
}
125
Mobile Application and A sample execution is shown below:
User experience Design Lab
1 Total vehicles: 4
2 Audi - 4
3 Ford - 10
4 BMW - 5
5 Mercedes - 3
6
7 Found total 4 Audi cars!
8
9 After clear operation, size: 0
TreeMap
The TreeMap is a Red-Black tree implementation that is sorted according
to the natural ordering of its keys, or by a Comparator provided at the
creation time. Also, this class maintains order on its elements. Finally,
this class is not synchronized and thus, if an application uses multiple
threads, the map must be synchronized externally.
A simple example that uses a TreeMap is shown below:
TreeMapExample.java:
01
package jcg.zheng.demo.data;
02
03
import java.util.Map;
04
import java.util.TreeMap;
05
06
public class TreeMapExample {
07
public static void main(String[] args) {
08
Map<String, Integer> vehicles = new TreeMap<>();
09
10
126
Location and Sensors
11 // Add some vehicles.
12 vehicles.put("BMW", 5);
13 vehicles.put("Mercedes", 3);
14 vehicles.put("Audi", 4);
15 vehicles.put("Ford", 10);
16
17 System.out.println("Total vehicles: " + vehicles.size());
18
19 // Iterate over all vehicles, using the keySet method.
20 for (String key : vehicles.keySet())
21 System.out.println(key + " - " + vehicles.get(key));
22 System.out.println();
23
24 System.out.println("Highest key: " + ((TreeMap) vehicles).lastKey());
25 System.out.println("Lowest key: " + ((TreeMap) vehicles).firstKey());
26
27 System.out.println("\nPrinting all values:");
28
29 for (Integer val : vehicles.values())
30 System.out.println(val);
31 System.out.println();
32
33 // Clear all values.
34 vehicles.clear();
35
36 // Equals to zero.
37 System.out.println("After clear operation, size: " + vehicles.size());
38 }
}
127
Mobile Application and A sample execution is shown below:
User experience Design Lab
01 Total vehicles: 4
02 Audi - 4
03 BMW - 5
04 Ford - 10
05 Mercedes - 3
06
07 Highest key: Mercedes
08 Lowest key: Audi
09
10 Printing all values:
11 4
12 5
13 10
14 3
15
16 After clear operation, size: 0
As you can observe, the elements of the map are printed in a strict
lexicographic order, which does not appear in the previous examples
of Hash Map and Hash Table.
128
package jcg.zheng.demo.data; Location and Sensors
01
02
import java.util.Enumeration;
03
import java.util.Map;
04
import java.util.concurrent.ConcurrentHashMap;
05
06
public class ConcurrentHashMapExample {
07
08
public static void main(String[] args) {
09
Map<String, Integer> vehicles = new ConcurrentHashMap<>();
10
11
// Add some vehicles.
12
vehicles.put("BMW", 5);
13
vehicles.put("Mercedes", 3);
14
vehicles.put("Audi", 4);
15
vehicles.put("Ford", 10);
16
17
System.out.println("Total vehicles: " + vehicles.size());
18
19
// Iterate over all vehicles, using the keySet method.
20
for (String key : vehicles.keySet())
21
System.out.println(key + " - " + vehicles.get(key));
22
23
System.out.println();
24
25
String searchKey = "Audi";
26
if (vehicles.containsKey(searchKey))
27
System.out.println("Found total " + vehicles.get(searchKey) + " " + searchKey + "
28
cars!\n");
29
30
Enumeration<Integer> elems = ((ConcurrentHashMap) vehicles).elements();
31
while (elems.hasMoreElements())
32
System.out.println(elems.nextElement());
33
System.out.println();
34
35
Integer val = (Integer) vehicles.putIfAbsent("Audi", 9);
36
if (val != null)
37
System.out.println("Audi was found in the map and its value was updated!");
38
39
val = (Integer) vehicles.putIfAbsent("Nissan", 9);
40
if (val == null)
41
System.out.println("Nissan wasn't found in map, thus a new pair was created!");
42
System.out.println();
43
44
// The next statements throw a NullPointerException, if uncommented.
45
// vehicles.put("Nissan", null);
46
// vehicles.put(null, 6);
47
48
// Clear all values.
49
vehicles.clear();
50
51
// Equals to zero.
52
System.out.println("After clear operation, size: " + vehicles.size());
53
}
54
}
129
Mobile Application and A sample execution is shown below:
User experience Design Lab
01 Total vehicles: 4
02 BMW - 5
03 Mercedes - 3
04 Audi - 4
05 Ford - 10
06
07 Found total 4 Audi cars!
08
09 5
10 3
11 4
12 10
13
14 Audi was found in the map and its value was updated!
15 Nissan wasn't found in map, thus a new pair was created!
16
17 After clear operation, size: 0
130
● JDK 1.8 Location and Sensors
● Android Studio 2.1.2
● Android SDK 6.0
6. After filling in the activity name and title, click Finish. Don’t touch
the default values – they’re okay.
After a few seconds, your project will be built by Gradle. Then you’ll see
google_maps_api.xml and the MapsActivity.java files in the editor.
Note!
Before you try to run the app, you’ll need do get an API key. You can
find instructions on how to do this in your google_maps_api.xml file, and
we will explain how to do it in more detail in the next paragraph.
132
Location and Sensors
133
Mobile Application and You can find the XML layout file at res/layout/activity_maps.xml. It
User experience Design Lab should have this code in it:
fragment 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:id="@+id/map"
tools:context=".MapsActivity"
android:name="com.google.android.gms.maps.SupportMapFragment"
The maps activity Java file
MapsActivity.java is the file that’s responsible for the maps activity.
Here’s the code you should find in it:
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;
public class MapsActivity extends FragmentActivity implements
OnMapReadyCallback {
private GoogleMap mMap;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_maps);
SupportMapFragment mapFragment = (SupportMapFragment)
getSupportFragmentManager()
.findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
134
} Location and Sensors
@Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
// Add a marker in Sydney, Australia, and move the camera.
LatLng sydney = new LatLng(-34, 151);
mMap.addMarker(new
MarkerOptions().position(sydney).title("Marker in Sydney"));
mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));
}
}
If you don’t see this code in the file, just copy and paste it in after the
package name.
READ ALSO
Google Maps vs Apple Maps: Best Choice For Your Mobile Solution
8 mins to read
Map Objects
Maps are represented in the API by the GoogleMap and MapFragment
classes.
Follow these steps to add a map:
1. Follow the steps in the project configuration guide to get the API,
obtain a key, and add the required attributes to your Android manifest.
(You only need to do this once.)
2. Add a <fragment> element to the layout file for the Activity.
3. Get a Google Map object that’s a representation of a map. You can
modify it according to your needs. To get to it, you’ll need to
implement the On Map Ready Callback interface with the help of the
on Map Ready callback method.
4. Register the callback by calling get Map A sync() on the fragment.
135
Mobile Application and We’ll explain each step in detail below.
User experience Design Lab
1. Add a fragment :
Add a <fragment> element to the activity’s layout file to define a
Fragment object.
In this element, set the android:name attribute to
com.google.android.gms.maps.MapFragment. This will attach a
MapFragment to the activity.
Here’s where you can find the <fragment> element:
You can also add a MapFragment to an Activity in your code. To do this,
create a new MapFragment instance, then call
FragmentTransaction.add() to add the Fragment to the current Activity:
mMapFragment = MapFragment.newInstance();
FragmentTransaction fragmentTransaction =
getFragmentManager().beginTransaction();
fragmentTransaction.add(R.id.my_container, mMapFragment);
fragmentTransaction.commit();
Map types
The Google Maps API offers many types of maps so you can choose the
one that suits your app best. For example, if you have a travel app, you’ll
probably need a road map to show routes. Other use cases may require a
satellite view or even no map at all. You’ll also be able to find out how to
customize route on Google Maps app from documentation.
Here are the types of maps you can choose from:
Normal – a typical road map that shows roads, some human-built
features, and important natural features like rivers; road and feature
labels are also visible.
Hybrid – a satellite photograph with roads added; road and feature labels
are also visible.
Satellite – photograph data from satellites; road and feature labels are not
visible.
Terrain – contains topographic data including colors that show different
map features like water or vegetation, contour lines and labels, and
perspective shading; some roads and labels are also visible.
None – shows no tiles; the map will be rendered as an empty grid with
no tiles loaded.
Set the map type
To set the type of map, call the Google Map object’s set Map Type()
method, passing one of the type constants defined in Google Map. For
example, here’s how to display a hybrid map:
Google Map map;
...
// Sets the map type to be "hybrid"
map .set Map Type (GoogleMap.MAP_TYPE_HYBRID);
The image below shows a comparison of normal, hybrid, and terrain
maps for the same location:
138
Location and Sensors
1. Permissions
You’ll need two permissions to work with a map that has access to a
user’s location:
● android. permission. INTERNET
● android. permission. ACCESS_FINE_LOCATION
Note that ACCESS_FINE_LOCATION is a dangerous permission – in
Android versions 6.0 and above, the app needs to request this permission
while the app’s running. A user may or may not give permission, so you
need to keep that in mind.
2. Marker customization
Marker customization lets you change the shape and color of a marker to
make it suit your app. For example, if you develop an app for a retailer,
you can make markers look like the shop’s logo.
For this, you’ll need a Bitmap Descriptor object. You can get one with
the help of the Bitmap Descriptor Factory object.
139
Mobile Application and And how to create a custom marker:
User experience Design Lab
map.addMarker(new MarkerOptions().position(new LatLng(10,
10)).icon(
BitmapDescriptorFactory.fromResource(R.drawable.ic_launcher)));
BitmapDescriptorFactory also has other methods to get the marker icon:
– fromAsset, from the Assets folder
– fromBitmap, from a Bitmap object
– from File, from internal storage
– from Path, from a specified path
There are some other colors available with the default Marker method
,all of which are described in Help.
This is an example of a standard green marker:
map. add Marker(new Marker Options().position(new Lat Lng (-10, -
10)).icon(
Bitmap Descriptor Factory .default Marker (Bitmap Descriptor
Factory. HUE_GREEN)
140
Selecting notification categories Location and Sensors
1. Tap More on the bottom navigation bar and select Settings.
2. Toggle on the notification categories you’d like to receive
notifications for. If toggles are not displayed, first tap on a category of
interest and then tap Show notifications.
5.2 SUMMARY
Most Android-powered devices have built-in sensors that measure
motion, orientation, and various environmental conditions. These sensors
are capable of providing raw data with high precision and accuracy, and
are useful if you want to monitor three-dimensional device movement or
positioning, or you want to monitor changes in the ambient environment
near a device. For example, a game might track readings from a device's
gravity sensor to infer complex user gestures and motions, such as tilt,
shake, rotation, or swing. Likewise, a weather application might use a
device's temperature sensor and humidity sensor to calculate and report
the dew point, or a travel application might use the geomagnetic field
sensor and accelerometer to report a compass bearing.
5.3 REFERENCES
1. Smashing UX Design. (by Jesmond J. Chudley)
2. Don't Make Me Think. (by Steve Krug)
3. 100 Things Every Designer Needs to Know About People. (by Susan
Weinschenk)
4. Lean UX. (by Jeff Gothelf and Josh Seiden)
5. The Design of Everyday Things. (by Don Norman)
141
6
REST API INTEGRATION
Unit Structure
6.0 Objective
6.1 Introduction
6.2 Summary
6.3 References
6.4 Unit End Exercises
6.0 OBJECTIVE
A REST FUL API is an architectural style for an application program
interface (API) that uses HTTP requests to access and use data. That
data can be used to GET, PUT, POST and DELETE data types, which
refers to the reading, updating, creating and deleting of operations
concerning resources.
6.1 INTRODUCTION
Representational State Transfer (REST) is an architectural style that
defines a set of constraints to be used for creating web services. REST
API is a way of accessing web services in a simple and flexible way
without having any processing.
REST technology is generally preferred to the more robust Simple Object
Access Protocol (SOAP) technology because REST uses less bandwidth,
simple and flexible making it more suitable for internet usage. It’s used
to fetch or give some information from a web service. All
communication done via REST API uses only HTTP request.
Working: A request is sent from client to server in the form of a web
URL as HTTP GET or POST or PUT or DELETE request. After that, a
response comes back from the server in the form of a resource which can
be anything like HTML, XML, Image, or JSON. But now JSON is the
most popular format being used in web services.
In HTTP there are five methods that are commonly used in a REST-
based Architecture i.e., POST, GET, PUT, PATCH, and DELETE. These
correspond to create, read, update, and delete (or CRUD) operations
respectively. There are other methods which are less frequently used like
OPTIONS and HEAD.
● GET: The HTTP GET method is used to read (or retrieve) a
representation of a resource. In the safe path, GET returns a
representation in XML or JSON and an HTTP response code of 200
142
(OK). In an error case, it most often returns a 404 (NOT FOUND) or Rest API integration
400 (BAD REQUEST).
● POST: The POST verb is most often utilized to create new
resources. In particular, it’s used to create subordinate resources. That
is, subordinate to some other (e.g. parent) resource. On successful
creation, return HTTP status 201, returning a Location header with a
link to the newly-created resource with the 201 HTTP status.
● PUT: It is used for updating the capabilities. However, PUT can
also be used to create a resource in the case where the resource ID is
chosen by the client instead of by the server. In other words, if the
PUT is to a URI that contains the value of a non-existent resource ID.
On successful update, return 200 (or 204 if not returning any content
in the body) from a PUT. If using PUT for create, return HTTP status
201 on successful creation. PUT is not safe operation but it’s
idempotent.
● PATCH: It is used to modify capabilities. The PATCH request only
needs to contain the changes to the resource, not the complete
resource. This resembles PUT, but the body contains a set of
instructions describing how a resource currently residing on the
server should be modified to produce a new version. This means that
the PATCH body should not just be a modified part of the resource,
but in some kind of patch language like JSON Patch or XML Patch.
PATCH is neither safe nor idempotent.
● DELETE : It is used to delete a resource identified by a URI. On
successful deletion, return HTTP status 200 (OK) along with a
response body.
Idempotence : An idempotent HTTP method is a HTTP method that
can be called many times without different outcomes. It would not
matter if the method is called only once, or ten times over. The result
should be the same. Again, this only applies to the result, not the
resource itself.
Example : C
143
Mobile Application and Request and Response
User experience Design Lab
Now we will see how request and response work for
different HTTP methods. Let’s assume we have
an API(https://www.geeksforgeeks.org/api/students) for all students data
of gfg.
● GET: Request for all Students.
Request
GET:/api/students
Request
POST:/api/students
{“name”:”Raj”}
Request
PUT or PATCH:/api/students/1
{“name”:”Raj”}
Request
DELETE:/api/students/1
144
Android application runs on a single thread when launched. Due to this Rest API integration
single thread model tasks that take longer time to fetch the response can
make the application non-responsive. To avoid this we use android A
sync Task to perform the heavy tasks in background on a dedicated
thread and passing the results back to the UI thread. Hence use of A sync
Task in android application keeps the UI thread responsive at all times.
The basic methods used in an android A sync Task class are defined
below :
do In Background() : This method contains the code which needs to be
executed in background. In this method we can send results multiple
times to the UI thread by publish Progress() method. To notify that the
background processing has been completed we just need to use the return
statements
● On Pre Execute() : This method contains the code which is executed
before the background processing starts
● On Post Execute() : This method is called after do In Background
method completes processing. Result from do In Background is passed to
this method
● On Progress Update() : This method receives progress updates from do
In Background method, which is published via publish Progress method,
and this method can use this progress update to update the UI thread
The three generic types used in an android A sync Task class are given
below :
● Params : The type of the parameters sent to the task upon execution
● Progress : The type of the progress units published during the
background computation
● Result : The type of the result of the background computation
146
android:layout_alignTop="@id/tv_time" Rest API integration
android:inputType="number"
/>
<Button
android:id="@+id/btn_run"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Run Async task"
android:layout_below="@+id/in_time"
android:layout_centerHorizontal="true"
android:layout_marginTop="64dp" />
<TextView
android:id="@+id/tv_result"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="7pt"
android:layout_below="@+id/btn_run"
android:layout_centerHorizontal="true" />
</RelativeLayout>
In the above layout we’ve used a predefined drawable as the border of
the EditText.
The MainActivity.java is defined below:
package com.journaldev.asynctask;
import android.app.ProgressDialog;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
147
Mobile Application and import android.widget.TextView;
User experience Design Lab
public class MainActivity extends AppCompatActivity {
private Button button;
private EditText time;
private TextView finalResult;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
time = (EditText) findViewById(R.id.in_time);
button = (Button) findViewById(R.id.btn_run);
finalResult = (TextView) findViewById(R.id.tv_result);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
AsyncTaskRunner runner = new AsyncTaskRunner();
String sleepTime = time.getText().toString();
runner.execute(sleepTime);
}
});
}
private class AsyncTaskRunner extends AsyncTask<String, String,
String> {
private String resp;
ProgressDialog progressDialog;
@Override
protected String doInBackground(String... params) {
publishProgress("Sleeping..."); // Calls onProgressUpdate()
try {
int time = Integer.parseInt(params[0])*1000;
148
Thread.sleep(time); Rest API integration
resp = "Slept for " + params[0] + " seconds";
} catch (InterruptedException e) {
e.printStackTrace();
resp = e.getMessage();
} catch (Exception e) {
e.printStackTrace();
resp = e.getMessage();
}
return resp;
}
@Override
protected void onPostExecute(String result) {
// execution of result of Long time consuming operation
progressDialog.dismiss();
finalResult.setText(result);
}
@Override
protected void onPreExecute() {
progressDialog = ProgressDialog.show(MainActivity.this,
"ProgressDialog",
"Wait for "+time.getText().toString()+ " seconds");
}
@Override
protected void onProgressUpdate(String... text) {
finalResult.setText(text[0]);
}
149
Mobile Application and }
User experience Design Lab
}
In the above code we’ve used AsyncTaskRunner class to perform the
AsyncTask operations. The time in seconds is passed as a parameter to
the class and a ProgressDialog is displayed for the given amount of time.
Open a Connection
From the above URL object, we can invoke the open Connection method
to get the Http URL Connection object.
We can't instantiate Http URL Connection directly, as it's an abstract
class:
150
Http URL Connection con = Rest API integration
(HttpURLConnection)url.openConnection();
Uses
The term itself is broad and has many applications. In information
technology (IT) alone, the term has several different applications. In most
IT contexts, asynchronous refers to a style of communication that can
occur both between people and between technological components. Since
the term casts such a wide net, even within IT, it can be difficult to
reconcile its general definition when comparing its various applied uses.
One simple way to understand asynchronous is through the lens of
personal communication. Sending an email or text is an example of an
asynchronous form of communication because they do not necessarily
have to be coordinated in time. Each event or sent message can happen at
irregular intervals because the information is stored for whenever the
recipient chooses to access it. Events happen independently of each other
and have no fixed agenda.
This can be contrasted against in-person conversations and video
conferencing, which are synchronous communication methods, because
the events -- turns in conversation -- need to happen in order and over a
152
fixed span of time -- the amount of time that participants are engaged in Rest API integration
the conversation. The events are dependent on each other and build on
top of one another in a linear fashion.
The bottom line is: In synchronous personal communications, recipients
must respond immediately; in asynchronous, they can respond at their
convenience.
This general model applies to most asynchronous contexts, the variables
being the units of information -- referred to as objects or events -- and the
medium used to communicate them.
Some prominent examples of the term's use are in computer
programming, in which the program is communicating with the
computer, and telecommunication, in which signals are transmitted at
certain rates and affect the quality of the information they contain based
on those rates.
Asynchronous in telecommunication
In telecommunication signaling -- within a network or between networks
-- an asynchronous signal is one that is transmitted at a different clock
rate than another signal. Plesiochronous signals are almost but not quite
in synchronization -- and a method is used to adjust them --
and synchronous signals are those that run at the same clock rate.
153
Mobile Application and Examples
User experience Design Lab
Below are a few applied examples of the term asynchronous as it is used
in each context mentioned above.
Telecommunication : The clarity of transmission is critical when
communicating using devices such as a radio or telephone. It requires the
data being exchanged to be processed by both parties in phase with each
other, according to a shared rate. When this is done using a centralized
clock, it is asynchronous transmission.
However, it can be done asynchronously as well. Asynchronous transfer
mode (ATM) is a protocol used in telecommunications to enable the
asynchronous transmission of data without the signals having to pass
through a mainframe or centralized clock. Instead, ATM establishes a
pathway through the network for the data and assigns it a traffic contract
that ensures data is processed according to an agreement made between
the client and the network. For example, this can guarantee a constant bit
rate for telephone calls, ensuring a caller's voice is not cut off or delayed.
Programming : One tangible example of a program that operates
asynchronously is a printer's embedded software. When a printer sends
out a low toner alert to the user, it continues to print. The printer does not
stop everything to issue the alert and then resume. The part of the
program that issues the alert is not dependent on the part that triggers
printing. They can occur simultaneously because they function
independently.
Ok Http Android
Initially Android had only two HTTP clients: Http URL
Connection and Apache HTTP Client; for sending and receiving data
from the web. Each of these clients required a lot of boilerplate code to
be written inside the A sync Task or the background thread methods.
Moreover, these clients have their own sets of limitations when it came
to cancelling an HTTP request or connection-pooling.
Ok Http android provides an implementation of Http URL
Connection and Apache Client interfaces by working directly on a top
of java Socket without using any extra dependencies.
154
3. Caching Rest API integration
4. Recovering from network problems
5. Redirects
6. Retries
7. Support for synchronous and asynchronous calls
Inbuilt Types :
The data returned by an API plays vital role in implementation of
network call and its handling. It is one of the important parameter to
decide which option we should use. Volley can capture four types of
responses automatically through these requests:
String Request – This type of request converts the response into a String.
JSON Object Request – This type of request and response is
automatically converted into a JSON Object.
JSON Array Request – This type of request and response is automatically
converted into a JSON Array.
155
Mobile Application and Image Request – This type of request converts the response into a
User experience Design Lab decoded bitmap.
Retrofit can parse many other types of responses automatically like:
Boolean – Web API response needs to be a Boolean.
Integer – Web API response needs to be an integer.
Date – Web API response should be Long format date.
String – Web API response needs to be in String format.
Object – Web API response needs to be in JSON object.
Collections – Web API response needs to be in a String Format.
Image Loading:
Volley has an inbuilt support for image loading. It is packaged with a
loader a custom view called Network Image View which is specially
designed to download and show images.
On the other hand Retrofit does not provide any such feature, Other
libraries such as Picasso or glide is recommended to perform image
loading.
Caching : Android volley has a very elaborate and flexible caching
mechanism. When a request is made through volley first the cache is
checked for appropriate response if it is found there than it is returned
and parsed else network hit is made.
Retrofit does not support caching.
Retrying Mechanism : With volley we can set a retry policy using set
Retry Policy method. It support the customized request timeout, number
of retries and back off multiplier.
Retrofit does not support any retrying mechanism. But it can be achieved
manually by doing some extra code.
Request Cancellation : Both Volley and Retrofit supports request
cancellation.
Post Requests and Multipart uploads : Volley supports both post
requests and multipart uploads but for post requests we have to convert
our java objects to JSON Object. Also for multipart uploads we have to
do some extra code and use some additional classes.
6.2 SUMMARY
REST (Representational State Transfer) APIs, sometimes also referred to
as REST FUL APIs, are an increasingly popular design style. REST APIs
are built to take advantage of pre-existing protocols within an
environment, most commonly over HTTP for a Web API. The REST
API design is more lightweight and is known for its vast flexibility in
enabling modern business connectivity.
156
6.3 REFERENCES Rest API integration
157
7
DATABASE CONNECTIVITY AND
DISTRIBUTING ANDROID
APPLICATION
Unit Structure :
7.0 SQ Lite Programming
7.1 Android database connectivity using SQ Lite
7.2 Distribution options
7.3 Packaging and Testing the Application
7.4 Distributing applications on Google play store
7.5 Questions
7.6 Quiz
7.7 Moocs
7.8 Video lectures
7.9 References
158
SQLite Advantages: Database
Connectivity and
❖ SQLite is server less. Distributing Android
Application
❖ SQLite comes with zero-configuration.
❖ SQLite database is stored in a single cross-platform disk file.
❖ SQLite is very small and light weight.
❖ SQLite is self-contained.
❖ SQLite transactions are ACID-compliant.
❖ SQLite supports most of the query language features found in SQL92
(SQL2) standard.
❖ SQLite is written in ANSI-C and provides simple and easy-to-use
API.
❖ SQLite is available on UNIX (Linux, Mac OS-X, Android, iOS) and
Windows (Win32, WinCE, Win RT).
SQLite Limitations
Few unsupported features of SQL92 in SQLite are listed below:
Sr. No. Feature & Description
1 RIGHT OUTER JOIN
Only LEFT OUTER JOIN is implemented.
2 FULL OUTER JOIN
Only LEFT OUTER JOIN is implemented.
3 ALTER TABLE
The RENAME TABLE and ADD COLUMN variants of the ALTER
TABLE command are supported. The DROP COLUMN, ALTER
COLUMN, ADD CONSTRAINT are not supported.
4 Trigger support
FOR EACH ROW triggers are supported but not FOR EACH
STATEMENT triggers.
5 VIEWs
VIEWs in SQLite are read-only. You may not execute a DELETE,
INSERT, or UPDATE statement on a view.
6 GRANT and REVOKE
The only access permissions that can be applied are the normal file
access permissions of the underlying operating system.
SQLite Commands
The standard SQLite commands are CREATE, SELECT, INSERT,
UPDATE, DELETE and DROP and can be classified into groups based
on their operational nature:
159
Mobile Application and DDL - Data Definition Language
User experience Design Lab
Sr. Command & Description
No.
1 CREATE
Creates a new table, a view of a table, or other object in database.
2 ALTER
Modifies an existing database object, such as a table.
3 DROP
Deletes an entire table, a view of a table or other object in the database.
160
C:\>sqlite3 Database
Connectivity and
SQLite version 3.7.15.2 2013-01-09 11:53:05 Distributing Android
Application
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite>
sqlite>.help
The above command will display a list of various SQLite dot commands.
2 .bail ON|OFF
Stop after hitting an error. Default OFF
162
3 .databases Database
Connectivity and
List names and files of attached databases Distributing Android
Application
4 .dump ?TABLE?
Dump the database in an SQL text format. If TABLE
specified, only dump tables matching LIKE pattern
TABLE
5 .echo ON|OFF
Turn command echo on or off
6 .exit
Exit SQLite prompt
7 .explain ON|OFF
Turn output mode suitable for EXPLAIN on or off. With
no args, it turns EXPLAIN on
8 .header(s) ON|OFF
Turn display of headers on or off
9 .help
Show this message
11 .indices ?TABLE?
Show names of all indices. If TABLE specified, only show
indices for tables matching LIKE pattern TABLE
13 .log FILE|off
Turn logging on or off. FILE can be stderr/stdout
163
Mobile Application and 14 .mode MODE
User experience Design Lab
Set output mode where MODE is one of −
● csv − Comma-separated values
● column − Left-aligned columns.
● html − HTML <table> code
● insert − SQL insert statements for TABLE
● line − One value per line
● list − Values delimited by .separator string
● tabs − Tab-separated values
● tcl − TCL list elements
15 .nullvalue STRING
Print STRING in place of NULL values
16 .output FILENAME
Send output to FILENAME
17 .output stdout
Send output to the screen
18 .print STRING...
Print literal STRING
20 .quit
Exit SQLite prompt
21 .read FILENAME
Execute SQL in FILENAME
22 .schema ?TABLE?
Show the CREATE statements. If TABLE specified, only
show tables matching LIKE pattern TABLE
23 .separator STRING
Change separator used by output mode and .import
164
24 .show Database
Connectivity and
Show the current values for various settings Distributing Android
Application
25 .stats ON|OFF
Turn stats on or off
26 .tables ?PATTERN?
List names of tables matching a LIKE pattern
27 .timeout MS
Try opening locked tables for MS milliseconds
29 .timer ON|OFF
Turn the CPU timer measurement on or off
.show command to see default setting for your SQLite command prompt.
sqlite>.show
echo: off
explain: off
headers: off
mode: column
nullvalue: ""
output: stdout
separator: "|"
width:
sqlite>
Make sure there is no space in between sqlite> prompt and dot command,
otherwise it will not work.
Formatting Output
You can use the following sequence of dot commands to format your
output.
165
Mobile Application and sqlite>.header on
User experience Design Lab
sqlite>.mode column
sqlite>.timer on
sqlite>
sqlite>.schema sqlite_master
Case Sensitivity
SQLite is case insensitive, i.e. the clauses GLOB and glob have the
same meaning in SQLite statements.
166
Comments Database
Connectivity and
SQLite comments are extra notes, which can be added to increase its Distributing Android
readability and can appear anywhere. They begin with two consecutive "- Application
" characters (ASCII 0x2d) and extend up to and including the next
newline character (ASCII 0x0a) or until the end of input, whichever
comes first. We can also use C-style comments, which begin with "/*"
and extend up to and including the next "*/" character pair or until the
end of input, whichever comes first. C-style comments can span multiple
lines.
SQLite Statements
SQLite statements start with any of the keywords like SELECT,
INSERT, UPDATE, DELETE, ALTER, DROP, etc., and end with a
semicolon (;).
ANALYZE;
or
ANALYZE database_name;
or
ANALYZE database_name.table_name;
167
Mobile Application and BEGIN;
User experience Design Lab
or
BEGIN EXCLUSIVE TRANSACTION;
COMMIT;
168
stmt1; Database
Connectivity and
stmt2; Distributing Android
Application
....
END;
COMMIT;
SELECT COUNT(column_name)
FROM table_name
WHERE CONDITION;
169
Mobile Application and SQLite DROP TABLE Statement
User experience Design Lab
DROP TABLE database_name.table_name;
SELECT SUM(column_name)
FROM table_name
WHERE CONDITION
GROUP BY column_name;
SELECT SUM(column_name)
FROM table_name
WHERE CONDITION
GROUP BY column_name
170
HAVING (arithematic function condition); Database
Connectivity and
SQLite INSERT INTO Statement Distributing Android
Application
INSERT INTO table_name( column1, column2....columnN)
VALUES ( value1, value2....valueN);
SQLite IN Clause
PRAGMA pragma_name;
For example:
PRAGMA page_size;
PRAGMA cache_size = 1024;
PRAGMA table_info(table_name);
171
Mobile Application and SQLite RELEASE SAVEPOINT Statement
User experience Design Lab
RELEASE savepoint_name;
REINDEX collation_name;
REINDEX database_name.index_name;
REINDEX database_name.table_name;
ROLLBACK;
or
ROLLBCK TO SAVEPOINT savepoint_name;
SAVEPOINT savepoint_name;
UPDATE table_name
SET column1 = value1, column2 = value2....columnN=valueN
[ WHERE CONDITION ];
VACUUM;
172
$sqlite3 testDB.db Database
Connectivity and
SQLite version 3.7.15.2 2013-01-09 11:53:05 Distributing Android
Application
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite>
Syntax
ATTACH DATABASE 'DatabaseName' As 'Alias-Name';
sqlite> .database
seq name file
173
Mobile Application and --- --------------- ----------------------
User experience Design Lab
0 main /home/sqlite/testDB.db
2 test /home/sqlite/testDB.db
The database names main and temp are reserved for the primary
database and database to hold temporary tables and other temporary data
objects.
sqlite>.databases
seq name file
--- --------------- ----------------------
0 main /home/sqlite/testDB.db
2 test /home/sqlite/testDB.db
3 currentDB /home/sqlite/testDB.db
We will find that testDB.db is still connected with 'test' and 'main'.
sqlite>.databases
seq name file
--- --------------- ----------------------
0 main /home/sqlite/testDB.db
2 test /home/sqlite/testDB.db
174
CREATE TABLE database_name.table_name( Database
Connectivity and
column1 datatype PRIMARY KEY(one or more columns), Distributing Android
Application
column2 datatype,
column3 datatype,
.....
columnN datatype
);
175
Mobile Application and 7.1 ANDROID DATABASE CONNECTIVITY USING
User experience Design Lab SQLITE
SQLiteDatabase namespace defines the functionality to connect and
manage a database. It provides functionality to create, delete, manage
and display database content.
Create a Database
Simple steps to create a database:
1. Create "SQLiteDatabase" object.
2. Open or Create a database and create a connection.
3. Perform insert, update or delete operation.
4. Create a Cursor to display data from the table of the database.
5. Close the database connectivity.
Step 1: Instantiate "SQLiteDatabase" object
SQLiteDatabase db;
We must import the android.database.sqlite.SQLiteDatabase namespace
in your application.
db=openOrCreateDatabase(String path, int mode, SQLiteDatabase.Curso
rFactory factory)
This method is used to create/open database. As the name suggests, it
will open a database connection if it is already there, otherwise, it will
create a new one.
Example:
db=openOrCreateDatabase("XYZ_Database",SQLiteDatabase.CREATE
_IF_NECESSARY,null);
Arguments:
This method returns a long. The row ID of the newly inserted row, or -1
if an error occurred.
Example,
db.insert("temp", null, values);
177
Mobile Application and Strign sql The SQL query
User experience Design Lab String You may include ?s in where clause in the query,
[]selectionArgs which will be replaced by the values from
selectionArgs. The values will be bound as Strings.
Example,
Cursor c=db.rawQuery("SELECT * FROM temp",null);
Methods
Is After Last Returns false, if the cursor pointer is not at last position
of a result set.
Example:
c.moveToFirst();
while(!c.isAfterLast())
{
//statement…
c.moveToNext();
}
Step 6: Close Cursor and Close Database connectivity
It is very important to release our connections before closing our
activity. It is advisable to release the Database connectivity in "onStop"
method. And Cursor connectivity after use it.
DatabaseDemoActivity.java
1. package com.DataBaseDemo;
2. import android.app.Activity;
3. import android.content.ContentValues;
4. import android.database.Cursor;
5. import android.database.SQLException;
178
6. import android.database.sqlite.SQLiteDatabase; Database
Connectivity and
7. import android.os.Bundle; Distributing Android
Application
8. import android.view.View;
9. import android.widget.Button;
10. import android.widget.EditText;
11. import android.widget.Toast;
12. public class DataBaseDemoActivity extends Activity {
/** Called when the activity is first created. */
13. SQLiteDatabase db;
14. Button btnInsert;
15. @Override
16. public void onCreate(Bundle savedInstanceState) {
17. super.onCreate(savedInstanceState);
18. setContentView(R.layout.main);
19. btnInsert=(Button)findViewById(R.id.button1);
20. try{
21. db=openOrCreateDatabase("StudentDB",SQLiteDatabase.CRE
ATE_IF_NECESSARY,null);
22. db.execSQL("Create Table Temp(id integer,name text)");
23. }catch(SQLException e)
24. {
25. }
26. btnInsert.setOnClickListener(new View.OnClickListener() {
27. @Override
28. public void onClick(View v) {
29. // TODO Auto-generated method stub
30. EditText eid=(EditText) findViewById(R.id.editText1);
31. EditText ename=(EditText)findViewById(R.id.editText2);
32. ContentValues values=new ContentValues();
33. values.put("id", eid.getText().toString());
179
Mobile Application and 34. values.put("name", ename.getText().toString());
User experience Design Lab 35. if((db.insert("temp", null, values))!=-1)
36. {
37. Toast.makeText(DataBaseDemoActivity.this, "Record Succe
ssfully Inserted", 2000).show();
38. }
39. else
40. {
41. Toast.makeText(DataBaseDemoActivity.this, "Insert Error",
2000).show();
42. }
43. eid.setText("");
44. ename.setText("");
45. Cursor c=db.rawQuery("SELECT * FROM temp",null);
46. c.moveToFirst();
47. while(!c.isAfterLast())
48. {
49. Toast.makeText(DataBaseDemoActivity.this,c.getString(0)+
" "+c.getString(1),1000).show();
50. c.moveToNext();
51. }
52. c.close();
53. }
54. });
55. }
56. @Override
57. protected void onStop() {
58. // TODO Auto-generated method stub
59. db.close();
60. super.onStop();
61. }
62. }
180
Database
Connectivity and
Distributing Android
Application
If you want to see where your database stored? Follow below instruction.
1. Start Your Emulator ( It is necessary to start Emulator to see File
Explorer content)
2. Open "File Explorer"
181
Mobile Application and
User experience Design Lab
3. Data -> Data -> find your "package" -> databases -> "database"
182
Distributing Your Apps by Email Database
Connectivity and
Distributing Android
Application
Figure 1. Users can simply click Install when you send them an
application via email.
An easy and quick way to release your apps is to send them to users by
email. When the user open your email on their Android-powered device,
the Android system recognizes the APK and displays an Install Now
button in the email message (see the above Figure 1). Users can install
your app by touching the button.
Distributing apps through email is convenient if you’re sending them to a
few trusted users, as it provides few protections from piracy and
unauthorized distribution; that is, anyone you send your apps to can
simply forward them to others.
Figure 2. Users must enable the Unknown sources setting before they can
install apps not downloaded from Google Play.
Android protects users from inadvertent download and install of apps
from locations other than Google Play (which is trusted). It blocks such
installs until the user opts-in Unknown sources in Settings > Security,
183
Mobile Application and shown in Figure 2. Users need to make this configuration change before
User experience Design Lab they download your apps to their devices.
Format Description
ETC2 Supported by all OpenGL 3.x class devices and supports
alpha compression.
DXT Supported by Nvidia Tegra GPUs and supports alpha
compression.
ASTC Latest Texture compression format allowing more quality
control by specifying block size and supports alpha
compression. Available on some devices at this point.
184
Format Description Database
ETC1 Supported by all Android based devices but cannot Connectivity and
Distributing Android
compress alpha textures (they are stored uncompressed).
Application
Recommend using an RGB and a separate alpha texture if
need alpha to get better compression.
ETC1a Uses ETC1 for non-alpha textures and ETC2 for alpha
texture. If the device does not support ETC2, alpha textures
will be uncompressed into RGBA at runtime. This format
can be used on both ETC1 and ETC2 devices, but ETC1
for non-alpha textures may not be as high-quality as ETC2.
ATC Supported by Qualcomm Adreno GPUs and supports alpha
compression.
PVRTC Supported by PowerVR GPUs and supports alpha
compression.
2. You will be prompted for a location to save your packaged game,
which should default to your project folder. Create a new folder and
call it AndroidBuilds.
5. Navigate to the folder you created in step two. There will be a new
folder named specifically for the texture type you selected when
packaging. In this example, the folder is named Android_ETC2.
185
Mobile Application and
User experience Design Lab
If you do not have your device plugged in via USB, running the .BAT
file will do nothing.
When you have completed this How-To, your project should appear on
your Android device per the following image:
186
In addition, you will have packaged .APK files and accompanying Database
helpers to deploy them to other devices for testing. Connectivity and
Distributing Android
Packaging App Bundles Application
Now when you package a project for Android, you will generate a .aab
file to upload to Google Play. You will also generate a universal .apk for
testing purposes.
The other settings available for configuring App Bundle builds enable
you to fine-tune the degree of sensitivity that the App Bundle will use in
generating the final .apks for your project.
Setting Description
Generate Enabling this setting will allow the App Bundle to
Universal APK generate a universal .apk file for end-users, which
from Bundle can be run on any kind of device. This does not
affect the universal .apk that is generated for
testing on your machine.
Enable ABI Split The App Bundle will generate separate .apks
based on the Application Binary Interface used by
the user's CPU. For example: arm64-v8a, x86,
x86_64.
Enable language The App Bundle will generate separate .apks
split based on the user's language. Only strings
localized for the user will be downloaded.
187
Mobile Application and Enable density The App Bundle will generate separate .apks
User experience Design Lab split based on image resolution and DPI. Only icons
and splash screens compatible with the user's
device will be downloaded.
If you enabled ABI split but disabled language split, the .aab would tailor
the final APK to a user's device based on the compatible ABI for their
device, but every user would receive resources for all languages
regardless of their device or language settings. The default settings will
result in the smallest possible size for the final .apk, while disabling these
settings will result in larger .apks.
Test Structure
Android's build and test tools assume that test projects are organized into
a standard structure of tests, test case classes, test packages, and test
projects.
JUnit
You can use the JUnit TestCase class to do unit testing on a class that
doesn't call Android APIs. TestCase is also the base class for
AndroidTestCase, which you can use to test Android-dependent objects.
Besides providing the JUnit framework, AndroidTestCase offers
Android-specific setup, teardown, and helper methods.
188
In order to use TestCase, extend your class with TestCase class and Database
implement a method call setUp(). Connectivity and
Distributing Android
public class MathTest extends TestCase { Application
For each test implement a method which interacts with the fixture. Verify
the expected results with assertions specified by calling
assertTrue(String, boolean) with a boolean.
The assert methods compare values you expect from a test to the actual
results and throw an exception if the comparison fails.
Once the methods are defined you can run them.
Monkey
The UI/Application Exerciser Monkey, usually called "monkey", is a
command-line tool that sends pseudo-random streams of keystrokes,
touches, and gestures to a device. You run it with the Android Debug
Bridge (adb) tool.
You use it to stress-test your application and report back errors that are
encountered. You can repeat a stream of events by running the tool each
time with the same random number seed.
189
Mobile Application and Monkey features
User experience Design Lab
Monkey has many features, and is categorized to four:
❖ Basic configuration options
❖ Operational constraints
❖ Event types and frequencies
❖ Debugging options
Monkey Usage
In order to use monkey, open up a command prompt and just navigate to
the following directory.
android ->sdk ->platform-tools
Once inside the directory, attach your device with the PC , and run the
following command.
adb shell monkey -p your.package.name -v 500
This command can be broken down into these steps.
● adb - Android Debug Bridge. A tool used to connect and sends
commands to your Android phone from a desktop or laptop computer.
● shell - shell is just an interface on the device that translates our
commands to system commands.
● monkey - monkey is the testing tool.
● v - v stands for verbose method.
● 500- it is the frequency conut or the number of events to be sent for
testing.
190
In the above command, you run the monkey tool on the default android Database
UI application. By typing this command , you are actually generating 500 Connectivity and
random events for testing. Distributing Android
Application
Example
It creates a basic application which can be used for monkey. To
experiment with this example, you need to run this on an actual device
and then follow the monkey steps explained in the beginning.
Steps Description
1 You will use Android studio to create an Android application
under a package com.tutorialspoint.myapplication.
2 Modify src/MainActivity.java file to add Activity code.
3 Modify layouta XML file res/layout/activity_main.xml add
any GUI component if required.
4 Create src/second.java file to add Activity code.
5 Modify layout XML file res/layout/view.xml add any GUI
component if required.
6 Run the application and choose a running android device and
install the application on it and verify the results.
package com.tutorialspoint.myapplication;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
191
Mobile Application and import android.view.View;
User experience Design Lab
import android.widget.Button;
public class MainActivity extends AppCompatActivity {
Button b1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
b1=(Button)findViewById(R.id.button);
}
package com.tutorialspoint.myapplication;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
public class second extends Activity{
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.view);
Button b1=(Button)findViewById(R.id.button2);
192
b1.setOnClickListener(new View.OnClickListener() { Database
Connectivity and
@Override Distributing Android
Application
public void onClick(View v) {
Toast.makeText(second.this,"Thanks",Toast.LENGTH_SHORT).show();
}
});
}
}
193
Mobile Application and android:layout_height="wrap_content"
User experience Design Lab
android:text="Tutorials point"
android:id="@+id/textView2"
android:layout_below="@+id/textView"
android:layout_alignRight="@+id/textView"
android:layout_alignEnd="@+id/textView"
android:textColor="#ff36ff15"
android:textIsSelectable="false"
android:textSize="35dp" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageView"
android:src="@drawable/abc"
android:layout_below="@+id/textView2"
android:layout_centerHorizontal="true" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button"
android:onClick="button"
android:id="@+id/button"
android:layout_below="@+id/imageView"
android:layout_centerHorizontal="true"
android:layout_marginTop="100dp" />
</RelativeLayout>
194
Here is the content of view.xml Database
Connectivity and
<?xml version="1.0" encoding="utf-8"?> Distributing Android
Application
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="button"
android:id="@+id/button2"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Tutorials point "
android:id="@+id/textView3"
android:textColor="#ff3aff22"
android:textSize="35dp"
android:layout_above="@+id/button2"
android:layout_centerHorizontal="true"
android:layout_marginBottom="90dp" />
</RelativeLayout>
<resources>
<string name="app_name">My Application</string>
</resources>
195
Mobile Application and Here is the content of AndroidManifest.xml.
User experience Design Lab
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.tutorialspoint.myapplication" >
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER"
/>
</intent-filter>
</activity>
<activity android:name=".second"></activity>
</application>
</manifest>
To run the app from Android studio, open one of your project's activity
files and click Run icon from the toolbar.
196
Database
Connectivity and
Distributing Android
Application
Select your mobile device as an option and then check your mobile
device which will display application screen.
197
Mobile Application and
User experience Design Lab
Once you click on it a pop up will be shown like this where you have to
choose your Default language and Title of your app. Then click on
the CREATE button.
198
Database
Connectivity and
Distributing Android
Application
Then you scroll down the page and now you have to add the Hi-res
icon of your app.
Ant next thing you have to provide is the Feature Graphic of your app.
Note that this graphic is then used everywhere your app is featured on
Google Play.
199
Mobile Application and
User experience Design Lab
And finally when you click on SAVE DRAFT button you can see
that Store listing tab is now become turned to green and you are done for
Store listing.
200
Database
Connectivity and
Distributing Android
Application
After that on the next page, you have to upload your APK file
in Android App Bundles and APKs to add section.
201
Mobile Application and
User experience Design Lab
202
After that fill your email address as well as confirm the email address. Database
Connectivity and
Distributing Android
Application
After selecting your app category make sure that you read all of these
and answer them correctly.
203
Mobile Application and
User experience Design Lab
When you redirected to another page scroll down and click on APPLY
RATING button. And you are done for Content rating section. Don’t
forget to notice that Content rating section is now become turned to
green.
204
Database
Connectivity and
Distributing Android
Application
Then go down and down and check out the Content guidelines and US
export laws section by marking them tick mark. And click on the SAVE
DRAFT button. Don’t forget to notice that Pricing &
distribution section is now become turned to green tick.
205
Mobile Application and And then provide a valid Privacy policy URL. Note that google will
User experience Design Lab check this.
Then select does your app contain ads or not? And click
on SAVE button.
206
Then again go back and continue further steps by clicking start button Database
in Target audience and content section. Connectivity and
Distributing Android
Application
In the next page select the Target age group and scroll down and click
on the Next button.
207
Mobile Application and On the next page click on the Save button and you are done for App
User experience Design Lab content section.
208
After usually 4 to 5 days they will review your app and let you know to Database
either approve or reject your app. Connectivity and
Distributing Android
Application
7.5 QUESTIONS
1) What is SQLite?
2) Who was the designer of SQLite?
3) What are the most important features of SQLite?
4) What are the advantages of using SQLite?
5) How would you create a database in SQLite?
6) How would you create a table in SQLite database?
7) How would you drop a table in SQLite database?
8) How would you create an AUTOINCREMENT field?
9) What data types are supported by SQLite?
10) How to insert data in a table in SQLite?
11) How would you retrieve data from SQlite table?
12) What is the use of UPADTE query in SQLIte?
13) How can you delete the existing records from a table in SQLite?
14) What is the use of WHERE clause in CRUD statements?
15) What is the usage of AND & OR operators with WHERE clause?
16) What is the usage of LIKE operator with WHERE clause?
17) What is the use of LIMIT clause with SELECT query?
209
Mobile Application and
User experience Design Lab 18) Why is ORDER BY clause used with SELECT statement?
19) What is the use of SQLite GROUP BY clause?
20) What is the use of DISTINCT clause in SQLite?
21) What is UNION operator? How does it work?
22) What is UNION ALL operator? What is the difference between
UNION and UNION ALL operator?
23) What is SQLite JOIN? How many types of JOINS are supported in
SQLite?
24) What is SQLite INNER JOIN?
25) What is SQLite OUTER JOIN?
26) Explain SQLite CROSS JOIN.
27) What is SQLite date and time () function?
28) What is the use of date() function in SQLite?
29) What is the use of datetime() function in SQLite?
30) What is SQLite julianday() function?
31) What is the use of SQLite now() function?
32) What is the usage of SQLite strftime() function?
33) What is the use of SQLite time() function?
34) What do you understand by SQLite aggregate functions?
35) What is SQLite MIN aggregate function?
36) What is SQLite MAX aggregate function?
37) What is SQLite AVG aggregate function?
38) What is SQLite COUNT aggregate function?
39) What is SQLite SUM aggregate function?
40) What is the difference between SQL and SQLite?
41) What is SQLite Transactions?
42) In which areas, SQLite is preferred most?
210
7.6 QUIZ Database
Connectivity and
1. The SQLite database management system is an ____ database. Distributing Android
Application
A. Embedded relational
B. Non-embedded relational
C. Non-relational
D. Structural
2. The SQLite database engine is ____. It is self-contained and no
configuration is required.
A. Serverless
B. Transactional
C. Both A and B
D. None of the above
3. An ____, self-contained, stand-alone, transactional relational database
engine, SQLite is designed to be embedded within an application
without requiring additional configuration.
A. Open-source
B. Closed-source
C. Open-end
D. Open-wire
4. SQLite differs from most other SQL databases because it is based on a
server process instead of a ____ server.
A. Unique
B. Mixed
C. Configured
D. Separate
5. In SQLite, files are ____ directly to disk.
A. Read
B. Written
C. Both A andB
D. None of the above
211
Mobile Application and 6. Typically, a single disk file contains the entire SQL database,
User experience Design Lab including ____ and views.
A. Tables
B. Indices
C. Triggers
D. ANSI-C
8. SQLite is -
A. Data-based
B. File-based
C. Structure-based
D. None of the above
9. SQLite supports many of the features of SQL and is fast; however,
____ procedures are not supported.
A. Stored
B. Bypass
C. Failed
D. Transactional
10. SQLite is a ____ database resource.
A. Interface
B. Non-interface
C. Portable
D. Non-portable
212
11. For your programming language to access that database, you'll need Database
an SQLite ____. Connectivity and
Distributing Android
A. Powerplug Application
B. Extension
C. Structure
D. Database
12. In contrast with other database management systems like SQL Server
or Oracle, SQLite is very small (less than ____ in size).
A. 200 kb
B. 500 kb
C. 1000 kb
D. 1 MB
13. What is/are the feature(s) of SQLite?
A. Totally free
B. Serverless
C. Very flexible
D. All of the above
14. What is not the feature of SQLite?
A. Configuration Not Required
D. Multiple
213
Mobile Application and 16. Several programming languages support SQLite's API such as -
User experience Design Lab
A. PHP
B. Java
C. Python
C. Both A and B
D. None of the above.
18. In addition to version control systems, financial analysis tools, media
cataloging and editing suites, CAD packages, and record keeping
programs, SQLite has been used successfully in many desktop
applications as well as ____ file formats.
A. On-disk
B. Off-disk
C. Disk
D. None
19. What is/are the advantage(s) of SQLite?
A. Lightweight
B. Better Performance
C. No Installation Needed
214
21. As SQLite databases are almost ____ faster than the File system, Database
reading and writing operations are very fast. Connectivity and
Distributing Android
A. 10% Application
B. 35%
C. 65%
D. 95%
22. Instead of reading the whole file and storing it in memory, SQLite
only ____ the data that is needed.
A. Adds
B. Restores
C. Loads
D. Deletes
23. When you edit small segments of the file, SQLite ____ only the
portions that have been edited.
A. Writes
B. Rewrites
C. Overwrites
D. None
24. Which of the following is TRUE about the reliability of SQLite?
A. Your content is continuously updated, so when the power goes out
or the computer crashes, little or no work is lost.
B. I/O code written in SQLite is less likely to be bug-prone than
custom-written code.
C. In contrast to procedural code, SQLite queries are smaller, so the
chances of a bug occurring are lower.
C. Both A and B
D. None of the above
215
Mobile Application and 26. The same application file can be accessed and written by ____
User experience Design Lab processes without interfering with one another.
A. Two
B. Three
C. Five
D. Multiple
27. Which of the following is TRUE about the portability of SQLite?
A. There is one compatibility issues with any of the programming
languages
B. There are two compatibility issues with any of the programming
languages
C. There are no compatibility issues with any of the
programming languages
D. There are multiple compatibility issues with any of the
programming
28. What is TRUE about accessibility of SQLite?
A. A number of third-party tools are available for accessing the
SQLite database
B. There is a greater likelihood of recovering content from a SQLite
database if it has been lost
C. Code is short-lived compared to data
A. Cost
B. Size
C. Storage
D. Fields
216
30. What is TRUE about reducing the cost and complexity in SQLite? Database
Connectivity and
A. With the addition of new tables and/or columns, SQLite can Distributing Android
easily be extended in the future Application
C. Both A and B
D. None of the above
31. HTTP requests with _____ traffic is/are handled by SQLite.
A. Low
B. Medium
C. Both A and B
D. None of the above
32. Most databases have a size limit of ____.
A. 2 KB
B. 2 MB
C. 2 GB
D. 2 TB
33. With SQLite, there is no ____ required, making it an excellent choice
for small businesses.
A. Configuration
B. Administration
C. Both A and B
D. None of the above
34. How many types of SQLite commands are there?
A. 1
B. 2
C. 3
D. 4
217
Mobile Application and 35. Which of the following is/are SQLite command(s)?
User experience Design Lab
A. DDL
B. DML
C. DQL
C. 3
D. 4
38. Which of the following is/are the DDL command(s)?
A. CREATE
B. ALTER
C. DROP
218
41. You can delete a whole table, a view of a table, or any other object Database
within a database by using the ____ command. Connectivity and
Distributing Android
A. DELETE Application
B. DROP
C. REMOVE
D. None
42. How many commands are there in DML?
A. 1
B. 2
C. 3
D. 4
43. Which of the following is/are the command(s) in DML?
A. INSERT
B. UPDATE
C. DELETE
219
Mobile Application and 47. What does .bailon|off command do?
User experience Design Lab
A. It stops after hitting an error. default off
B. It starts after hitting an error
C. It stops after switching off
D. It defaults to off
48. What does .databases command do?
A. It removes files of attached databases
B. It adds files of attached databases
7.7 MOOCS
1. SQLite for beginners. Udemy. https://www.udemy.com/course/sqlite-
for-beginners/
2. SQLite Fundamentals - Comprehensive SQL course on SQLite.
Udemy. https://www.udemy.com/course/sqlite-sql-beginners/
3. Learn SQLite Programming on Android Kitkat. Udemy.
https://www.udemy.com/course/learn-sqlite-programming-on-
android-kitkat/
4. Learn SQLite Database in Android. Udemy.
https://www.udemy.com/course/learn-sqlite-database-in-android/
220
5. SQLite For Beginners Learn SQL from Scratch. Eduonix. Database
https://www.eduonix.com/courses/Web-Development/sqlite-for- Connectivity and
beginners-learn-sql-from-scratch Distributing Android
Application
6. Overview of SQLite. Coursera.
https://www.coursera.org/lecture/androidapps-2/overview-of-sqlite-
part-1-HsicE
7.9 REFERENCES
1. https://docs.unrealengine.com/4.26/en-
US/SharingAndReleasing/Mobile/Android/PackagingAndroidProject/
2. https://www.tutorialspoint.com/android/android_testing.htm
3. http://docs.52im.net/extend/docs/api/android-50/distribute/tools/open-
distribution.html
4. https://developer.android.com/distribute/marketing-tools/alternative-
distribution
5. https://www.tutorialspoint.com/sqlite/sqlite_create_table.htm
6. https://www.geeksforgeeks.org/how-to-publish-your-android-app-on-
google-play-store/
7. https://www.c-sharpcorner.com/UploadFile/88b6e5/sqlitedatabase-
connectivity/
221
8
OPEN SOURCE UX TOOLS
Unit Structure
8.1 Study of open source UX tools
8.2 Questions
8.3 Quiz
8.4 Moocs
8.5 Video Lectures
8.6 References
Fluid
Fluid is a web based tool for creating mobile app wireframes and
prototypes. It provides a drag and drop interface for building mobile app
mock-ups and comes with large library of ready-made iOS, Android and
Windows UI widgets for smartphone and tablet.
222
Open Source UX
Tools
InVision
In Vision allows you to easily create interactive prototypes by adding
hotspots to uploaded designs and provides lots of great collaboration and
presentation features, including annotations, tracked feedback and project
updates. It has lots of cool features like automatic Drop box syncing and
user testing capture and is probably the slickest prototyping tool currently
out there.
Marvel
Marvel allows you to create interactive web, tablet and mobile prototypes
from imported screen designs. You can automatically synch Photoshop
PSDs through Drop Box and even capture feedback from clients and
colleagues within the tool.
223
Mobile Application and
User experience Design Lab
Mock flow
Mock flow provide a suite of online design and prototyping tools. These
include Wireframe Pro for creating wireframes; Design Collab for
sharing and reviewing designs with your team; Website Pro, a
development platform to code, manager and host static websites;
Annotate Pro for annotating designs and Banner Pro for creating
annotated banners and slideshows in HTML5.
Open Office
Open Office is open source’s answer to Microsoft Office. It includes
Writer, a word processor; Calc a spreadsheet tool; Impress, that can be
used to create PowerPoint like prototypes and Draw for creating
diagrams, images and graphics.
224
Open Source UX
Tools
Origami
Origami is Facebook’s free prototyping tool. It allows you to create
desktop, tablet and mobile prototypes using imported screens and
components. It supports a wide range of interactions, such as scrolling,
swiping, tapping and dragging as well as common design patterns, such
as slide in navigation.
Pixate
Pixate is a mobile prototyping tool that allows you to build mobile
prototypes that run as native apps. There is both a PC and Mac version
and like most mobile prototyping tools you create a prototype from
design components that you import into the tool. Pixate has now joined
the growing family of Google tools, so expect more features to be added
in the future.
225
Mobile Application and
User experience Design Lab
Webflow
Webflow is a powerful drag and drop website builder used to design and
launch responsive websites without writing code and now supports not
only static websites, but CMS driven dynamic websites as well.
Weld
Weld is another drag and drop website builder that allows you to quickly
create responsive websites, prototypes and apps. It’s newer to the game
than Webflow and doesn’t yet have so many bells and whistles, but looks
very promising.
226
Open Source UX
Tools
Fig 10. Weld – A drag and drop website and prototype builder
DESIGN TOOLS
Gimp
Gimp is an open source graphics tool and is very useful for all manner of
graphic and design related tom foolery.
Pinterest
Pinterest describes itself as a visual discovery tool that you can use to
keep a track of great designs you find and to share things like design
patterns with others.
227
Mobile Application and
User experience Design Lab
Fig 12. Pinterest – Great for collating design examples and patterns
User research tools
Ever note
Ever note is a fantastic app for keeping track of notes, information,
photos, arte facts and anything else that you want to store and keep track
of. It’s a great way to maintain a digital repository of stuff for a project
and because you can sort your notes into notebooks and add tags, it’s
very easy to organise your notes and to retrieve information.
Reframer
Reframer is a qualitative analysis tool from Optimal Workshop. It allows
to add notes from user interviews and user testing sessions and to include
tags and a significance rating so that we can easily identify themes,
retrieve key information and generally slice and dice your data.
228
Open Source UX
Tools
Trello
Trello is a great tool for capturing, organising and tracking tasks and
information. It allows to create cards and boards to help track and
organise your stuff, be it tasks, research insights or simply ideas.
Fig 15. Trello – Useful for card sorting and lots of other UX related stuff
229
Mobile Application and
User experience Design Lab
Google hangouts
Google hangouts is a free video conferencing tool that is great for
communicating, collaborating and also remote user testing. It’s a great
way to run remote user testing sessions and even supports remote
desktop control so you can run a prototype locally and invite participants
to take control of your computer to use it.
Fig 17. Google hangouts – An easy way to carry out remote user testing
Join. me
Join. me is an online meeting tool, supports screen sharing and remote
desktop control.
230
Open Source UX
Tools
Treejack
Tree jack is another great UX tool from Optimal Workshop. Tree jack
allows you to test an information architecture (IA) by carrying out
‘reverse card sorting’. You upload your IA, which might be the site
structure or a taxonomy used then ask users where they would go to find
something within a clickable navigation tree of your IA.
Survey tools
Google forms
Google forms is a great way to quickly create online surveys. It’s a little
bit limited when compared to the Survey Monkeys and Survey Gizmos
of the world but what do you expect given that it’s free?
231
Mobile Application and
User experience Design Lab
Plot
Plot allows you to capture in-product video feedback from your users.
Users reply to questions (such as “How was your setup experience?”)
and can record in-product feedback videos with their screen and
microphone.
Annotation tools
Adobe reader
Adobe reader is of course Adobe’s free PDF viewer. Not only can it be
used to view PDFs but it can also be used to add annotations to a PDF.
232
Open Source UX
Tools
Windows Edge
Windows Edge is of course Microsoft’s replacement for Internet
Explorer – the much loathed ugly step sister of web browsers, and comes
free with Windows 10. Not only is a much better browser than its
predecessor, but it also allows you to annotate web pages.
Optimal Sort
Optimal Sort is an online card sorting tool from Optimal Workshop. It
allows you to carry out closed card sorting where by participants sort
items into predefined categories and open card sorting where by
participants can choose their own categories.
233
Mobile Application and
User experience Design Lab
Fig 25. Fire Shot – A great web page screen grab add-on
234
Open Source UX
Tools
ORIGAMI
Learn how to build, preview and share your prototypes.
COMMON INTERACTIONS
❖ Adding Logic
❖ Scrolling Views
❖ Horizontal Scrolling
❖ Screen Transitions
❖ Timed Animations
SMARTER INTERACTIONS
❖ Multiple States
❖ Masking Layers
❖ Orientation
❖ Device Motion
❖ Text Input
❖ Introduction to Loops
❖ Interactive Loops
❖ Prototyping with Data
❖ Create a Component
❖ Create a System
❖ Audio Metering
COMMON INTERACTIONS
235
Mobile Application and
User experience Design Lab
Or
Ideally a Tap on Color Fill would also close Modal. Hover over Color
Fill in the Layers panel and click Tap under the Touch menu.
236
Open Source UX
Tools
Keep an eye on the Down and Tap outputs of the Interaction patch whilst
interacting with Color Fill. We ultimately would like tapping on Cancel
or Color Fill to Turn Off the Switch. We need an Or patch to allow both
of these options. Double-click on the Patch Editor and add an Or
patch . Connect the Tap output from the Cancel Interaction patch to an
input of Or. Also connect the Tap output of Color Fill to the remaining
Or input.
You should see now that when we tap on Cancel or anywhere in the
Color Fill the output of Or will trigger.
Replacing with Or
We currently have only the Cancel Interaction Tap output connected to
Turn Off the Switch. Replace that connection by connecting the output of
Or to the Turn Off input of Switch.
237
Mobile Application and Now when we Tap on Color Fill or Cancel, the Turn Off of Switch is
User experience Design Lab triggered.
The new Interaction patch on the Patch Editor will now detect any Tap
on Send To.
Not
We want our Switch to Turn Off if Color Fill or Cancel are tapped, but
not when Send To is tapped. Origami has an appropriately named Not
patch for this purpose. Double-click on the Patch Editor and add in a
Not patch .
Connect the Tap output of our Send To Interaction patch to the input of
our Not patch. Observe the Not patch as the Send To layer is tapped in
the Viewer. Pulses will appear briefly on the Not patch, respective to
when the layer is tapped and not tapped.
238
Open Source UX
Tools
And
The Switch should Turn Off when Cancel is tapped or Color Fill is
tapped, and not when Send To is tapped. Origami has an And patch for
this purpose. Double-click on the Patch Editor and add an And patch
.
Connect the output of the Or patch directly to an input of the And patch.
Then connect the output of the And patch to the Turn Off input of the
Switch patch.
239
Mobile Application and These connections and orderings allow the following logic to be checked:
User experience Design Lab
Have the Cancel layer or Color Fill layer been tapped?
And has something else happened?
You can now connect the Not output to the second And input to finish
the last piece of logic.
Our final logic to be checked is now:
Have the Cancel layer or Color Fill layer been tapped?
And has there not been tapping on Send To?
When you Tap Color Fill and Send To, Modal will not close. If you Tap
Cancel or Color Fill elsewhere however, Modal will close.
TIMED ANIMATIONS
Create time-based, automatic animations.
We would like an animation to occur simply on its own — as soon as a
prototype starts, or with only a timer triggering it. Sometimes we want
multiple things to happen over time, all purely time-based, without any
tap triggers or the like.
Setting up
Click through each of these inputs to cause a pulse, making the Position
Y of Comments move up or down. Clicking on Set To 1 will bring up our
first position, Set To 2 our second, and so on.
240
Open Source UX
Tools
Prototype has already started, so we won’t see the effect of this until we
click the Restart Prototype button on the Viewer toolbar.
241
Mobile Application and Wait
User experience Design Lab
We are instantly going to Option 1, but what we actually want is for that
option to only kick-in after the prototype starts and holds off little bit, to
give a bit of breathing room. We want the prototype to Wait a second.
Insert a Wait patch between the When Prototype Starts and the Option
Switch. Double-click on the Patch Editor , type to find Wait, then
Return . Connect the When Prototype Starts output to the Start input in
the Wait patch, and the output of Wait to that Set to 1 input.
Restart our prototype now, and keep an eye on the first two patches. We
should see that the signal is immediately sent, and then after one second,
the signal is carried on to the Option Switch.
There are a few ways to automatically advance to the next Set To inputs,
but for the sake of simplicity, we are going to add more Wait patches as
our solution. These will then be connected to corresponding inputs in the
Option Switch. Add more Wait patches by double-clicking on the Patch
Editor , typing to find Wait, and then Return . Like the first Wait
patch, have the output of the When Prototype Starts go into its Start
input. Have the output of this Wait patch go to the next Option Switch
input, which is Set to 2.
242
Open Source UX
Tools
Give the second Wait patch a duration of 3 seconds. That means that the
3 seconds is counting from when the prototype starts, not 3 seconds from
when the first Wait patch is triggered.
Multiple delays
For the sake of simplicity, keep all timing connected to When Prototype
Starts. Add enough Wait patches to cover each Option Switch input (5 in
total). You can add new patches by double-clicking on the Patch Editor,
or by Option-clicking and dragging an existing one. That will create a
new Wait patch, with the same input connection.
Like earlier, click the Restart Prototype button and keep an eye on the
Wait patches as each Duration passes.
Each of these Duration values are measured from When Prototype Starts,
and send their respective outputs to the Option Switch accordingly. The
Option Picker takes each option and outputs a corresponding position for
Comments Y.
8.3 QUESTIONS
1. Describe your design process and what methods you follow.
2. Describe a recent project you were particularly challenged by and
how you approached the problem.
244
3. What are some of the biggest challenges you face as a UX Open Source UX
designer? Tools
8.4 QUIZ
1. Which of the following is golden rule for interface design?
a) Place the user in control
b) Reduce the user’s memory load
c) Make the interface consistent
d) All of the mentioned
Answer: d
245
Mobile Application and 2. Which of the following is not a design principle that allow the user to
User experience Design Lab maintain control?
a) Provide for flexible interaction
b) Allow user interaction to be interrupt-able and undo-able
c) Show technical internals from the casual user
d) Design for direct interaction with objects that appear on the screen
Answer: c
3. Which of the following is not a user interface design process?
a) User, task, and environment analysis and modeling
b) Interface design
c) Knowledgeable, frequent users
d) Interface validation
Answer: c
4. When users are involved in complex tasks, the demand on
__________ can be significant.
a) short-term memory
b) shortcuts
c) objects that appear on the screen
d) all of the mentioned
Answer: a
5. Which of the following option is not considered by the Interface
design?
a) the design of interfaces between software components
b) the design of interfaces between the software and human producers
and consumers of information
c) the design of the interface between two computers
d) all of the mentioned
Answer: c
246
6. A software might allow a user to interact via Open Source UX
Tools
a) keyboard commands
b) mouse movement
c) voice recognition commands
d) all of the mentioned
Answer: d
7. A software engineer designs the user interface by applying an iterative
process that draws on predefined design principles.
a) True
b) False
Answer: a
8. What incorporates data, architectural, interface, and procedural
representations of the software?
a) design model
b) user’s model
c) mental image
d) system image
Answer: a
9. What establishes the profile of end-users of the system?
a) design model
b) user’s model
c) mental image
d) system image
Answer: b
10. What combines the outward manifestation of the computer-based
system , coupled with all supporting information that describe
system syntax and semantics?
a) mental image
b) interface design
c) system image
d) interface validation
Answer: c
247
Mobile Application and 8.5 MOOCS
User experience Design Lab
1. User Experience (UX) Fundamentals. Udemy.
https://www.udemy.com/course/introtoux/
2. UI / UX Design Specialization. Coursera.
https://www.coursera.org/specializations/ui-ux-design
3. UI/UX. GreatLearning.
https://www.mygreatlearning.com/academy/learn-for-free/courses/ui-
ux
4. Google UX Design Professional Certificate. Coursera.
https://www.coursera.org/professional-certificates/google-ux-design
8.7 REFERENCES
1. https://www.uxforthemasses.com/more-free-ux-tools/
2. https://origami.design/tutorials/
3. https://origami.design/tutorials/common-interactions/timed-
animations
4. https://www.toptal.com/designers/ux/interview-questions
5. https://www.sanfoundry.com/software-engg-mcqs-user-interface-
design/
248
9
CREATING A NEW PROTOTYPE
Unit Structure
9.0 Device Selection
9.1 Prototyping Methodology
9.2 The Prototyping Process
9.3 Prototyping is Mandatory for Mobile
9.4 References
249
Mobile Application and Realize: Before a prototype is constructed, the merchandise is
User experience Design Lab totally conceptual. It's the primary step from concept to reality.
Solving: Prototyping may be a good way to visualize problems and
present solutions. If it doesn't work, throw the previous one and take a
look at the new one.
PAPER PROTOTYPING
Paper prototyping works best during early design stages. Team members
sketch ideas by hand using simple lines, shapes, and text. the stress is on
ingenuity and speed instead of aesthetics.
251
Mobile Application and
User experience Design Lab
252
Creating A
No Gut Responses - Paper prototypes depend on the user's imagination, New Prototype
adding an intermission between seeing a stimulus and reacting thereto.
This "gut feeling" response is critical to a successful UX.
DIGITAL PROTOTYPING
Digital prototyping is an exciting a part of the planning process.
Prototypes resemble the ultimate product, allowing teams to check and
validate their ideas.
253
Mobile Application and ❖ Speed: While paper prototypes can be the fastest thanks to test
User experience Design Lab ideas, digital prototypes are the quickest thanks to test usability
issues.
Disadvantages
❖ Learning curve: Before we will be able to build a prototype,
we’ll have to learn and understand the software—which is why
product teams often use Powerpoint rather than a specialized design
tool.
❖ Cost: As you progress from low-fidelity to high-fidelity prototyping,
time and labor costs increase.
A prototype’s success depends on teams outlining clear objectives and
KPIs for every usability study. Without a correct plan, designers can get
side-tracked, adding unnecessary features and interactions!
254
Advantages Creating A
New Prototype
❖ Final product functionality: HTML prototypes provide
participants with an accurate model of the ultimate product.
❖ The technical foundation for the ultimate product: Building an
HTML prototype provides researchers with a valuable research tool
and provides developers with the foundations for building the
ultimate product.
❖ Platform agnostic: We will be able to test your prototype on
virtually any software or device, and therefore the user won’t have
to run outside software.
Disadvantages
❖ Dependent on designer skill level: HTML prototype is
merely pretty much as good as your ability to code. Poorly coded
prototypes could introduce usability issues that don’t have
anything to try and do with UX design!
❖ Inhibits creativity: Coding takes time and focus to create a usable
prototype. Designers may not achieve the identical level of
innovation or creativity as employing a familiar design tool.
255
Mobile Application and Paper => Lo-fi Digital => Code
User experience Design Lab
Going from Lo-fi prototyping to code is an old approach that few teams
ever use nowadays. While lo-fi prototyping is affordable, it doesn’t catch
many of the usability issues high-fidelity prototypes expose.
Product developers without design skills might use the paper => lo-fi
digital => code method because it’s quicker for them to code than find
out how to use a design tool.
The process is precisely just like the example above, except that teams
will skip the hi-fi digital step.
256
HTML Prototyping => Code Creating A
New Prototype
Solo developers might skip any early prototyping methods and go
straight to code. With nobody to bounce ideas with, it can add up for a
developer to leap straight in.
Essentially, the prototype creates a foundation and evolves into the
ultimate product. This prototyping method is merely effective for skilled
product developers with efficient workflows.
Even designers with excellent design skills might want to avoid this
method of prototyping. Low-fidelity and high-fidelity prototyping are
significantly faster than building and editing code.
257
Mobile Application and Try Prototyping with UI Components
User experience Design Lab
UX Pin has just released a replacement tool, Merge Component
Manager that creates it easy for designers to import and manage UI
components that come from a React-based Design System, like Ant
Design, and use those true components to make interfaces within the UX
Pin editor.
259
Mobile Application and How Prototyping Makes Usability Testing Easier
User experience Design Lab
The reason divide the tasks into wireframes, mockups, and prototypes is
because each contains a different purpose.
By focusing only on structuring in wireframing, for instance, we’re able
to create a solid structure without distracting ourselves just yet with
mockup visuals or prototype functionality. While wireframing and
mockups lean more towards the creative and abstract, prototyping is
about knuckling down and bringing ideas to life — which requires
usability testing to urge right.
261
Mobile Application and We’ve found the subsequent to be the foremost compelling reasons for
User experience Design Lab mobile prototyping:
❖ Flow makes or breaks the mobile experience: Because mobile
experiences span several pages, user flow should be front and center
on the list of design priorities. Just visit UXArchive to work out how a
number of the highest companies like Snapchat, Google Maps, et
al architect their mobile flows.
❖ Animations make the experience fun & desirable: Animations are
the core element to mobile micro-interactions, with gesture-triggered
effects like timing, velocity, and bounciness adding a part of fun while
providing visual feedback and affordance. try this piece to work
out the contrasting views on animations from Google Material Design
and Apple iOS, then see 20 samples of these best practices in action.
❖ UX mistakes are costlier: Mobile app costs range from $6,000 to
upwards of $200,000, with the typical cost hovering around
$6,400. coping with the App Store can even be a headache, so some
up-front prototyping can go a protracted ways in saving time, money,
and sanity.
Select the Text tool from the Tools panel, click on the header area and
kind “Nature”. Double-click the text and from the correct Properties
panel, select “Helvetica”, set its weight to “bold”, and size to “32”.
Double-click the Fill color and set it to “dark gray”.
263
Mobile Application and
User experience Design Lab
264
the content and choose Ungroup Grid to interrupt the linkage between Creating A
them. New Prototype
265
Mobile Application and 9. Setup the Project Homepage
User experience Design Lab
Before putting in the linkage between pages, we want to assign a
homepage for the project. The homepage will be any of the created
pages. during this example, we are going to assign the primary layout we
created because the homepage by clicking on the house icon that appears
to the highest left of the art board.
266
11. Creating Interaction Creating A
New Prototype
In this prototype, the primary content block on the homepage should
jump to the primary content art board, and therefore the second content
block should link to the second art board…etc. So, select the
primary content block, and click on the proper blue arrow to line the
target similarly to what we did in step 10. Repeat the step with the
second content block.
267
Mobile Application and 13. Sharing the Prototype
User experience Design Lab
We’re done! Now we just have to share our document with other team
members or stakeholders who aren’t necessarily using XD. Click on the
Share icon at the highest right of the application; a floating menu will
appear, providing a URL which will be copied and shared between team
members:
9.4 REFERENCES
1. https://www.freecodecamp.org/news/ui-ux-design-tutorial-from-zero-
to-hero-with-wireframe-prototype-figma/
2. https://aspirity.com/blog/complete-guide-design-prototyping
3. https://www.toptal.com/designers/prototyping/guide-to-prototype-
design
4. https://www.interaction-design.org/literature/topics/prototyping
5. https://www.uxpin.com/studio/blog/what-is-a-prototype-a-guide-to-
functional-ux/
6. https://designshack.net/articles/graphics/how-why-prototypes-are-
mandatory-for-good-design/
7. https://webdesign.tutsplus.com/tutorials/how-to-create-a-ui-prototype-
using-adobe-xd--cms-26585
268
10
IDENTIFY AND DESCRIBE THE
OBJECTIVES FOR UED EXPERIMENT
Unit Structure :
10.0 UX Design
10.1 Perform user research
10.2 User requirement collection
10.3 User Requirement Analysis
10.4 Create User personas, user scenarios , customer journey maps
10.5 References
10.0 UX DESIGN
User experience (UX) design is the process of building products that are
easy and enjoyable for people to use. By building products to be as
effortless as possible for users, you can encourage adoption, retention,
and loyalty.
UX is an iterative process of constant improvement: product teams and
designers use data and usability testing to continuously refine the product
experience so it becomes easier for users as the product develops.
269
Mobile Application and The basic UX design process can be classified into five steps to illustrate
User experience Design Lab the cyclical, iterative nature of UX design:
3. Testing
Next, your product team will conduct user tests—like A/B tests, MVT,
and split tests—to identify existing or potential design issues that may
cause friction for users. For example, your team may find:
❖ The UX is confusing and prevents users from accomplishing their
goals
❖ Some features aren’t worth developing further because users aren’t
interested in them
❖ Certain user actions create friction in the product experience
4. Launch
Throughout the testing phase, you’ll refine your prototype based on
results and user feedback, make changes, and add final touches before
launch.
Once your product is ready, launch is often done in stages. For
example, your UX team might release a beta version or ‘soft launch’,
where a new design is launched to a small group of users first, to get
additional user feedback and usage data before rolling it out to your
whole user base.
270
5. Iteration Identify And
Describe The
UX design is a constant, iterative process—you’re never done creating Objectives For UED
good UX—so more testing follows the product’s launch. Experiment
In the iteration stage, your team will continue to make updates and
improvements as needed, and closely monitor how those changes impact
the product experience.
A/B and multivariate testing are often part of this stage, so your team can
see the impact of product changes and compare multiple versions of the
design to see which creates the best user experience. Then the winning
version is rolled out.
Importance of UX design?
A poor user experience will cost you customers as they aren’t satisfied
with their experience in your product—if it’s difficult for them to
navigate, if they encounter bugs or issues that cause friction—they might
churn. When you make UX design a key part of your product
development process, and keep product experience top of mind, you
can mitigate churn.
Your product team, in particular, can draw on UX design to:
271
Mobile Application and
User experience Design Lab
Fig 1: UX Design
272
Moleskine’s iOS calendar app, Time page, is a counter-example: the app Identify And
lets users choose the color theme, but while the UI looks cool, it makes it Describe The
harder for users to view their options and tap the color they want. Objectives For UED
Experiment
Fig 3: Time page's design in cool, but it puts design over functionality
273
Mobile Application and Objectives
User experience Design Lab
A project objective is a statement of a measurable goal for the project.
Let’s talk about objectives in more detail.
274
A solid objective has the following characteristics: Identify And
Describe The
❖ Easy to understand. Objectives For UED
Experiment
❖ Distinct.
❖ Measurable.
❖ This is an objective for the entire company, but is too broad for a
specific project. Multiple initiatives at the company need to come
together to make this happen; any one site or application
may help with this but will be very unlikely to be able to handle the
entire burden—unless the entire company is about this one site or
application and it ends up being wildly successful.
275
Mobile Application and 10.1 PERFORM USER RESEARCH
User experience Design Lab
User experience research is the systematic investigation of your users in
order to gather insights that will inform the design process. Typically
done at the start of a project—but also extremely valuable throughout—it
encompasses different types of research methodology to gather
both qualitative and quantitative data in relation to your product or
service.
Before we continue, let’s consider the difference between qualitative
and quantitative data.
276
Identify And
Describe The
Objectives For UED
Experiment
277
Mobile Application and a real-world context, highlighting any issues that need to be ironed
User experience Design Lab out before you go ahead and develop it.
278
Business Requirements Identify And
Describe The
UX designers must answer the question, “What does the business want to Objectives For UED
achieve from this project?” An example of a business requirement might Experiment
be, “Increase new user sales conversion by 20% without affecting
retention.”
Team members use stakeholder interviews and other documentation to
gather and understand these business requirements.
Business requirements include:
❖ Project timeline
❖ Project scope
❖ Branding rules
❖ Various departmental goals–business, marketing, sales, customer
services, etc.
❖ Competitors
❖ Stakeholder expectations
User Requirements
Who are the users, and what do they need from this project? Are there
any specific usability or accessibility issues designers must solve?
❖ User interviews
❖ Surveys
❖ Dairy studies
Technical Requirements
Technical requirements fall into two categories:
❖ Functional: Outlines the product’s specifications, technical
capabilities, and limitations
❖ Non-functional: Describes the product’s performance, such as
usability, performance, data integrity, and maintenance
The requirements will answer key technical questions for design teams:
❖ What is the product’s operating system (iOS, Android, Windows,
etc.)?
❖ What devices will the product operate on (mobile, tablet, web,
smart devices, etc.)?
❖ What front-end framework does the product use (React, Vue,
Angular, etc.)?
279
Mobile Application and ❖ What are the product’s technical limitations?
User experience Design Lab
Who is Responsible for Gathering These Requirements?
A representative from each department within the project is responsible
for gathering the relevant requirements. For example:
❖ Business
❖ User
❖ Technical
The above is an example of a typical project. These responsibilities will
vary depending on the company, project, etc.
How to Capture UX Design Requirements
Business Requirements
❖ 1:1 Interviews – meeting with individual stakeholders and experts
allows you to discuss specific topics in detail
❖ Workshops – an opportunity to discuss issues with multiple
stakeholders and team members
❖ Documentation – reviewing various business guidelines, manuals,
and other documentation relevant to the project
❖ Competitor research
❖ Surveys
❖ Storyboards
❖ Mood boards
280
User Requirements Identify And
Describe The
❖ User interviews Objectives For UED
Experiment
❖ Usability testing existing products
❖ Existing user experience research–user personas, journeys
❖ Surveys
❖ Diary studies
❖ Focus groups
❖ Storyboards
Technical Requirements
❖ Technical stakeholder interviews
❖ Systems reviews
❖ Technical documentation and specifications
❖ Data analysis
Document UX Requirements
Documenting the relevant business, user, and technical requirements is
crucial. This documentation will provide UX designers with a starting
point and reference for the project. Categorizing your UX requirements
document will help team members find the information they need. Here
are some recommendations for UX requirement categories:
❖ User stories & personas
❖ Task flows
❖ Style guides
❖ Specifications
❖ Manuals
❖ Competitor research
281
Mobile Application and Best Practices for Gathering UX Requirements
User experience Design Lab
282
❖ Ask open-ended questions so as not to bias answers. Identify And
Describe The
❖ Always leave an appropriate amount of silence at the end of an Objectives For UED
answer in case the interviewee wants to add or elaborate. Experiment
Build empathy
Empathy is a core value if designers want to make something that is
good for the people who are going to use it. Personas help designers to
create understanding and empathy with the end-users. Thanks to
personas designers can:
● Gain a perspective similar to the user. Creating user personas can
help designers step out of themselves and recognize that different
people have different needs and expectations. By thinking about the
needs of a fictional persona, designers may be better able to infer
what a real person might need.
● Identify with the user they are designing for. The more designers
engage with the user personas and see them as real people, the more
likely they will be to consider them during the design process and
want to create the best product for them.
284
Identify And
Describe The
Objectives For UED
Experiment
285
Mobile Application and
User experience Design Lab
An important aspect of user scenarios is that they can help the team
understand more than what the goals of the user are. Many design teams
believe the main advantage of having user scenarios is that once we
establish what the user’s goal is, it becomes easier to define how the user
would go about reaching that goal. That is closely connected to other
tools in the UX game, like mental models and user personas.
Some prefer short and sweet user scenarios that focus only one the user
goal or task. Others claim we can obtain even more benefits from a more
complete scenario, with additional information about users that adds
value – like their main source of income.
287
Mobile Application and What does a user scenario look like?
User experience Design Lab
User Scenarios are useful for designers because they can spark ideas,
generate features and help refine any requirements going forward. They
are also crucial when it comes to usability testing. With user scenarios
and a professional wireframe tool, designers can make sure they cover all
their bases and validate every move users make in the product.
288
User scenario examples to learn from Identify And
Describe The
1. Social Security platform user scenario Objectives For UED
Experiment
289
Mobile Application and 5. Pete the avid reader: user scenario
User experience Design Lab
290
Once the map is ready, you should measure the enhanced journey’s Identify And
results. For instance, check key performance indicators (KPIs). The more Describe The
touch points there are, the more complex the map will be. Objectives For UED
Experiment
10.5 REFERENCES
1. https://www.hotjar.com/ux-design/
2. https://www.interaction-design.org/literature/topics/ux-design
3. https://www.peachpit.com/articles/article.aspx?p=1856033
4. https://careerfoundry.com/en/blog/ux-de
5. sign/the-importance-of-user-research-and-how-to-do-it/
6. https://www.uxpin.com/studio/blog/the-beginners-guide-to-capturing-
ux-requirements/
7. https://www.usabilitypartners.se/services/user-requirements-
analysis.php
8. https://xd.adobe.com/ideas/process/user-research/putting-personas-to-
work-in-ux-design/
291
11
UX DESIGN - FOR WEB AND MOBILE
APPLICATION
Unit Structure :
11.0 Conceptual Design - Site Maps
11.1Ccreate Wireframe
11.2 Create Screens ,Widgets ,Outlines
11.3 Setting Properties
11.4 Ordering Screens ,Screen Transition
11.5 Adding Actions & Triggers ,Header & Footer
11.6 References
Sitemap Importance
Sitemap is a useful process for designers and UX professionals who are
looking for a way to improve website navigation, understand the scope of
work, and avoid missing out on critical parts of a website’s architecture.
Ultimately, site mapping helps you deliver a better user experience. Let’s
dive deeper and understand the purpose of sitemaps.
293
Mobile Application and i. Grab Miro’s Sitemap Template
User experience Design Lab
Your sitemap will be used by different teammates and stakeholders, so
it’s important to document your decisions digitally so they are easily
accessible by everyone on the team. If you are using Miro, you can
start by choosing the site mapping template from the library.
Case studies
❖ Education
❖ Legal
❖ Business
❖ Etc.
Pricing
❖ Free Tier
❖ Personal Tier
❖ Business Tier
❖ Etc.
294
i. Put your pages together using the template UX Design - For
Web And Mobile
Sort out your stickies, putting secondary pages under primary pages in Application
columns.
295
Mobile Application and used to create the global and secondary navigation to ensure the
User experience Design Lab terminology and structure used for the site meets user expectations.
Examples of wireframes
Well-known companies are shown to visualize website’s structure and
the relationships between certain pages. They are:-
296
iii. Facebook – Mid-Fidelity Website Wireframe:- UX Design - For
Web And Mobile
This wireframe displays a user page with a profile picture, cover Application
photo, and user chats. We can clearly see the feed and "About" section
as well as the gallery placeholder. Elements and buttons are already
aligned and we only need to add graphics here to show the full page
functionality.
297
Mobile Application and In Vision: In Vision allows you to get feedback straight from your team
User experience Design Lab and users through clickable mock-ups of your site design. It’s completely
free too!
Wireframe.cc: Wireframe.cc provides you with the technology to create
wireframes really quickly within your browser, the online version of pen
and paper.
Wireframe Sketcher: Wireframe Sketcher is a wire framing tool. It is
used for creating wireframes, mockups, and prototypes for desktop, web,
and mobile applications. The application is offered in a desktop version
as well as a plug-in for any Eclipse IDE such as Flash Builder,
ColdFusion Builder, Astana, My Eclipse, and Zend Studio.
298
UX Design - For
Web And Mobile
Application
299
Mobile Application and
User experience Design Lab
300
UX Design - For
Web And Mobile
11.2 CREATE SCREENS ,WIDGETS ,OUTLINES Application
Here for creating screen, widgets and outline we will be use the tool
called “Wireframe Sketcher”. It will be performed as follows:-
Wireframe Sketcher has a flexible user interface consisting of editors and
views all working together. These user interface parts can be
conveniently laid out in various ways to best suit your preferences.
Wireframe Sketcher comes with an initial arrangement that is called Wire
framing perspective.
If you are using the standalone version of Wireframe Sketcher then Wire
framing perspective will be open for you by default. If you are using an
Eclipse IDE then open the Wire framing perspective using Window >
Open Perspective > Other… > Wire framing.
To change this arrangement, you can drag & drop views around,
maximize and minimize them, make views float, or close altogether. You
can always restore any closed view using Window > Show View menu.
You can also restore the layout to its initial configuration of views using
Windows > Reset Perspective…. You can also save various layout
configurations using Window > Save Perspective As…, and then toggle
between these layouts to suit better your current task.
For creating screens:-
i. Screens can be created or modified using Screen Editor.
ii. The editor works along with other views like Palette, Properties, Links
and Outline. Double-click the editor’s tab to maximize it and
temporarily gain more screen space. Double-click the tab again to
restore editor’s position.
iii. New screen can be created using New Screen wizard. Specify the
parent folder and the name of the .screen file. Make sure that you have
at least one project in your workspace. If not, then you can create one
using the Wireframe Project wizard.
301
Mobile Application and iv. To open the New Screen wizard select File > New > Screen.
User experience Design Lab Alternatively, right-click on a folder in the Project Explorer and select
New > Screen:
❖ For widgets:-
1. Screens are drawn by adding widgets and other assets from palette to
them.
2. Various ways to add widgets :-
i. Drag and drop the palette item onto the editor canvas. The widget
will have its size calculated automatically.
ii. Select the palette item and then draw a bounding box in the editor
canvas to place the widget and give it an initial size.
iii. Double click palette item to add it.
iv. Open the Quick Add dialog (Ctrl+Space), start typing a widget
name, select the widget and then press Enter to place it.
Selecting widget
To select a widget just click on it. For multiple selection hold the Ctrl
key while clicking to toggle the selected state of a widget. Hold Shift
while clicking to add a widget to the current selection.
Selected widgets have a blue rectangle around them – move handle, and
white or black squares which are resize handles. One widget that has
black resize handles is called primary or anchor selection. This is the last
widget selected. Relative actions such as align and match size use
primary selection as their reference.
302
UX Design - For
Web And Mobile
Application
Shape widget brings a set of common shapes that support text and other
common properties. At the same time Rectangle and Circle widgets were
deprecated as Shape widget provides a much more flexible alternative:
303
Mobile Application and
User experience Design Lab
Other changes
❖ Added round border option for Button widget.
❖ Added header toggle property for List widget.
❖ Added automatic image refresh in editor on image change.
❖ Changed “Clone Screen” action to include source screen as
component instead of copying it.
❖ Improved the look of Tabs widget and made it resizable horizontally.
❖ Disabled delete action for locked widgets.
❖ Renamed “Export to HTML” action to “Share Online”.
❖ Improved painting performance.
❖ Removed “Advanced” button from new screen and storyboard
wizards.
❖ Fixed center alignment for widgets with “\n” in text.
❖ Fixed the behavior of Image widget placeholder on resize.
304
❖ Fixed the error sometimes occurring when overriding properties. UX Design - For
Web And Mobile
For outlines:- Application
The Outline view displays the overview of the edited contents. For
screens it displays widgets in their Z-order, those in the back being at the
top of the list and those in the front being at the bottom. For storyboards
it displays the list of included screens.
Border Toggle Lets you toggle on and off the border for
Shape, List, Table and Tree widgets.
305
Mobile Application and Curly Brace Lets you switch the orientation of a Curly
Brace between Left, Right, Top and
User experience Design Lab Bottom.
Line Style Lets you control the line style for Arrow,
Shape, Horizontal and Vertical Line.
Available styles are Solid, Dotted and
Dashed.
Position & Size Gives you a fine control over position and
size properties. Use arrow keys to
increment and decrement values. Lock
toggle lets you lock a widget in place so it
gets out of your way. Auto-size button
forces a widget to resize to its preferred
size. When editing
groups or components the anchor drop-
down becomes available and allows to
control anchor settings.
306
Selection Lets you specify the selected item or row. UX Design - For
Web And Mobile
Application
Selection Toggle Lets you toggle the selected state for
Checkbox and Radio Button widgets.
SVG Image Lets you choose the .svg image file from
available assets for SVG Image widget.
Image can be flipped horizontally and
vertically and rotated in 90 degrees
increments.
307
Mobile Application and
User experience Design Lab
Note:- Send Backward and Bring Forward are highlighted using red
box.
Better screen flows
The latest release brings the long awaited export option for screen flows.
Screen flows can now be exported as an extra page in PDF document:
308
Screen flows also got a long-needed face lift. Multiple links between a UX Design - For
pair of screens are now collapsed to a single link. Link labels were also Web And Mobile
removed as most of the time they are of little use: Application
Screen flows can now also be printed. So if you need a single page with
your screen flow then just go to “Screenflow” tab and print it. With the
right system setup you can also print to PDF.
The last addition are align and distribute actions. These actions make it
easy to layout screen flows with large number of screens.
Other changes
❖ Improved Ctrl+MouseWheel to zoom on mouse cursor position.
❖ Added “minus” icon.
❖ Cleaned up built-in icons to look better when rotated.
❖ Fixed an error when removing a rotated icon.
❖ Fixed an issue with “+” character in image file names.
❖ Fixed icon rotation in Label widget.
❖ Fixed the z-order of link areas in exported HTML.
309
Mobile Application and Tips about styles, placement, and wording to create better user
User experience Design Lab interfaces
i. Make buttons look like buttons
310
iv. Don’t have more than one primary action button on the screen at UX Design - For
a time Web And Mobile
Application
Placement
The placement of your buttons matter. Again, they have used many sites
and applications before yours and gotten used to certain button placement
patterns.
311
Mobile Application and vi. Full page designs should have the primary button on the left side
User experience Design Lab of the page
Wording
The words you use matter. Words in buttons are meant to be clicked or
tapped to execute an action. Make sure to clearly explain what your
button will do, once clicked.
312
ix. Use task specific words UX Design - For
Web And Mobile
If the user is adding an item to a cart, write "Add to Cart". If you’re Application
about to publish a blog post, “Publish” should be the action word
within the button.
313
Mobile Application and ADDING TRIGGERS
User experience Design Lab
Notification Triggers
Notification Triggers allows you to schedule local notifications that don't
require a network connection, which makes them ideal for use cases like
calendar apps.
Web developers can display notifications using the Web Notifications
API. This feature is often used with the Push API to inform the user of
time-sensitive information, such as breaking news events or received
messages. Notifications are shown by running JavaScript on the user's
device.
Notification triggers solve this problem by letting you schedule
notifications with their triggering condition in advance, so that the
operating system will deliver the notification at the right time even if
there is no network connectivity or the device is in battery saver mode.
The Navigation
Arguably the most important part of your header is the layout and design
of the navigation. This section is like a table of contents for all the pages
on your website. It’s how users can find what they need from you, so it’s
pretty crucial that you get it right.
Hamburger Navigation
FOOTER
The website footer is the section of content at the very bottom of a web
page. It typically contains a copyright notice, link to a privacy policy,
sitemap, logo, contact information, social media icons, and an email sign-
up form. In short, footer contains information that improves a website’s
overall usability.
315
Mobile Application and What to Put in a Website Footer
User experience Design Lab
❖ Copyright Notice
❖ Privacy Policy Link
❖ Sitemap
❖ Logo
❖ Contact Information
❖ Social Media Icons
❖ Email Sign-up Form
11.6 REFERENCES
1. https://balsamiq.com/learn/articles/button-design-best-practices/
2. https://www.smashingmagazine.com/2009/10/call-to-action-buttons-
examples-and-best-practices/
3. https://notification-triggers.glitch.me/
4. https://vtldesign.com/web-strategy/navigation-header-design/
316
12
UX EVALUATION
Unit Structure :
12.0 Set UX Goals
12.1 Perform UX Evaluation and Reporting
12.2 Usability Test
12.3 Questions
12.4 Quiz
12.5 Video Lectures
12.6 Moocs
12.7 References
317
Mobile Application and For example, Facebook at the beginning didn’t take “making friends with
User experience Design Lab strangers (say, a friend’s friend)” seriously as they believed that people
only have curiosities on their surroundings; social network is essentially
“a game among acquaintances”. However the data show that most of
users like to expand their circles by adding strangers as their friends.
Now social platform also contributes a lot to companies and brands who
want more influence online. They put money and energy on operating an
official page to promote their products. All of these are unexpected
demands for the early designers. Thus, collecting users’ feedback
constantly and make use of data or other materials to follow your users’
activities is also a key to meet users’ demands. If UX designers don’t
give users what they want, the users will give a shit.
318
more functions after a period of time? Those are all questions that user UX Evaluation
experience designers should concern about.
CONSTRUCTS
In all cases, however, there are certain aspects of user experience that
researchers are interested in (measures), and certain procedures and
techniques used for collecting the data (methods). There are many
measures and some high-level constructs of user experience that can be
used as the basis for defining the user experience measures, for example:
1. Utility: Does the user perceive the functions in the system as useful
and fit for the purpose?
2. Usability: Does the user feel that it is easy and efficient to get things
done with the system?
3. Aesthetics: Does the user see the system as visually attractive? Does it
feel pleasurable in hand?
4. Identification: Can I identify myself with the product? Do I look good
when using it?
5. Stimulation: Does the system give me inspiration? Or wow
experiences?
6. Value: Is the system important to me? What is its value for me?
To properly evaluate user experience, metrics and other factors
surrounding a study need to be taken into account, for example:
❖ Data (metrics): The time taken to complete a task.
❖ Scale (metrics): Indicators that show effectiveness, efficiency and
satisfaction.
❖ Other Factors: Conditions of use, the surrounding environment and
other human factors.
320
METHODS UX Evaluation
An individual method can collect data about a set of specific constructs
of user experience. For instance, usability testing is used to collect data
about usability construct. Methods also differ if they are to measure a
momentary or episodic experience (i.e., assessing how a person feels
about a specific interaction episode or after executing a task) or an
experience over time, also known as an longitudinal experience. UXA
methods can be classified in three categories: implicit, explicit and
creative methods.
Implicit methods
Implicit methods of UX research focus not just only on what the users
say, but also on what the user cannot express verbally. Many available
tools can assist in the implicit evaluation, in particular to gather implicit
or objective data. When available, UX researchers utilize state of the art
equipment to uncover all aspects of the experience.
Examples of implicit evaluation methods and tools:
❖ Eye tracking
❖ Attention tracking
❖ User tracking
❖ Task and reaction measurement, galvanic skin response or skin
conductance
❖ Electroencephalography (EEG)
❖ Observation studies: participant observation where observers monitor
the participant's reactions such as facial and other gestures, the tone
of voice or other body language cues
Explicit methods
Explicit methods of UX research explore what the user is consciously
aware of getting them to reflect on their own feelings or thoughts, and
gather their views and opinions. An important aspect of explicit methods
includes usability testing and emotion evaluation.
Emotion assessment
When investigating momentary user experiences, we can evaluate the
level of positive affect, negative affect, joy, surprise, frustration, etc. The
measures for emotions are bound to the methods used for emotion
assessment, but typical emotion measures are e.g. valence and arousal.
Objective emotion data can be collected by psycho physiological
measurements or by observing expressed emotions. Subjective emotional
data can be collected by using self-report methods, which can be verbal
or non-verbal.
321
Mobile Application and Examples of emotion assessment methods:
User experience Design Lab
❖ Psycho physiological emotion measurements aim to identify emotions
from physiological changes in muscles (e.g. face), pupils, skin, heart,
brains, etc.
❖ Expression
❖ Think aloud protocol can be used for reporting emotions (real-time
verbal self-report)
❖ Positive and Negative Affect Schedule (PANAS) (retrospective verbal
self-report)
❖ Geneva emotion wheel[4] (retrospective verbal self-report)
❖ Photographic Affect Meter (PAM)
❖ Emotion slider[6] (continuous non-verbal self-report)
❖ Sensual evaluation instrument (SEI)[7] (snapshot non-verbal self-
report)
❖ Pr Emo, a new version of Emo Cards for assessing emotion[8]
(snapshot non-verbal self-report)
Creative methods
Equally important to implicit and explicit methods are the creative
methods that the user researcher can utilize in order to bring together the
design team's view, as well as the target market's dreams, aspirations and
ideas of optimal design. These activities are more open and allow people
to either co-create with the engineers/designers, or to use their
imagination to express their ideal system.
Examples of creative assessment methods
❖ Co-design activities
❖ Creativity workshops
❖ Paper prototyping, wireframing, mind mapping
❖ Card sorting
❖ Personas
Longitudinal
In contrast to identifying a momentary emotion, longitudinal UXA
investigates how a person feels about a system as a whole, after using it
for a while.
Examples of longitudinal UXA methods (excluding traditional usability
methods):
322
❖ Diary methods for self-reporting experiences during field studies UX Evaluation
❖ Experience sampling method (ESM) for self-reporting during field
studies
❖ Day reconstruction method (DRM) – story-telling to reveal the
meaningful experiences during field studies
❖ AttrakDiff questionnaire for overall UX evaluation
❖ User experience questionnaire (UEQ) (available in several language
versions)
❖ Ladder interviews – e.g. to find out attitudes or values behind
behaviour or experience
❖ Holistic user experience (HUX)[14] identifying the relevant product
factors for holistic user experience
323
Mobile Application and
User experience Design Lab
324
❖ No outdated or incorrect data like contact information/address UX Evaluation
should be present.
❖ No broken links should be present.
User Friendliness
❖ Controls used should be self-explanatory and must not require
training to operate
❖ Help should be provided for the users to understand the
application/website
❖ Alignment with the above goals helps in effective usability testing
325
Mobile Application and Methods of Usability Testing:
User experience Design Lab
2 Techniques
There are two methods available to do usability testing –
1. Laboratory Usability Testing
2. Remote Usability Testing
Laboratory Usability Testing : This testing is conducted in a separate
lab room in presence of the observers. The testers are assigned tasks to
execute. The role of the observer is to monitor the behavior of the testers
and report the outcome of testing. The observer remains silent during the
course of testing. In this testing, both observers and testers are present in
a same physical location.
Remote Usability Testing : Under this testing observers and testers are
remotely located. Testers access the System Under Test, remotely and
perform assigned tasks. Tester’s voice , screen activity , testers facial
expressions are recorded by an automated software. Observers analyze
this data and report findings of the test. Example of such a software –
http://silverbackapp.com/
UX Testing Checklist
327
Mobile Application and Usability Testing Disadvantages
User experience Design Lab
328
Top 16 tools which are a good fit for usability testing tools for better UX. UX Evaluation
1. Maze
2. Look back
3. User Testing
4. Optimal Workshop
5. Usability Hub
6. Loop11
7. User feel
8. Try My UI
9. Hot jar
10. User Zoom
11. Qualaroo
12. Usabilla
13. Crazy Egg
14. Optimizely
15. Userlytics
16. User brain
12.3 QUESTIONS
1. How can you define the Usability Testing?
2. How is Usability testing related to the functional testing?
3. List the steps that are covered as part of usability testing.
4. What is the difference between build and release?
5. What do you understand by bug status in case of usability testing?
6. Give the different types of bug status?
7. What is Data-driven testing? Is it related to usability testing too?
8. What are the benefits offered by the data-driven testing?
9. Explain the important and considerable points to write usability test
cases
10. What is Automation Testing? Can usability testing be automated?
329
Mobile Application and 11. Explain Load Testing and Stress Testing.
User experience Design Lab
12. Explain the volume testing.
13. Explain different types of Usability Testing.
14. What are the benefits of usability testing for website owners?
15. What is the major benefit of usability testing for businesses?
12.4 QUIZ
1. Which of the following is NOT an example of a context research
method?
a. Field study
b. Diary study
c. Usability test
d. Contextual inquiry
Answer: C
2. Visual hierarchy refers to the visual organization of page elements so
that the user can easily perceive:
a. The breadth of the content and controls available on the page
b. Whatever elements they are interested in first
c. Differences in all the elements on the screen
d. Which elements are related and their relative importance
Answer: D
3. Which of the following is an example of a good How might we
question?
a. How might we implement the tax-payment flow?
b. How might we ensure that people pay taxes on time?
c. How might we improve the user experience of the tax-payment
flow?
d. How might we get users to like our payment flow more?
Answer: B
330
4. What is keyword foraging? UX Evaluation
a. The user conducts a preliminary search to determine the right
keywords for her information need, then composes a search query
with those keywords.
b. The user scans the list of search suggestions to find the one that
most appropriately matches their need.
c. The researcher browses keyword statistics for a site to see what the
most popular keywords were for a given period.
d. The researcher interviews users about a topic to understand the set
of words that they are most likely to use in referring to that topic.
Answer: A
5. What is a disadvantage of vertical navigation?
a. Can accommodate only a small number of categories
b. Offers no room for growth
c. Is unfamiliar to users
d. Requires more space
Answer: D
6. What is grounding?
a. The process of establishing common ground with a communication
partner or a work team
b. The process of getting the user calm and comfortable at the
beginning of a user test
c. The process of collecting user data on which to base design
d. The process of connecting with users to build empathy
Answer: A
7. What characterizes organizations at stage 3 (Emergent) of NN/g’s
latest UX-maturity model?
a. UX work is comprehensive, effective, and pervasive.
b. UX work is rare, done haphazardly, and lacking importance.
c. The organization has semi systematic UX-related methodology that is
widespread, but with varying degrees of effectiveness and efficiency.
d. UX work is functional and promising but done inconsistently and
inefficiently.
Answer: D
331
Mobile Application and 8. The principle of closure says that people
User experience Design Lab
a. Assume that items within a boundary are related and part of the
same group
b. Perceive items that share a visual characteristic as related
c. Assume that items close together are part of the same group
d. Fill in blanks to perceive a complete object whenever an external
stimulus partially matches that object
Answer: D
9. Which of the following is an example of Campbell’s law?
a. Shoppers with niche needs making up for a high aggregated sales
volume
b. Airbnb hosts begging customers for high ratings
c. Small number of web pages accumulating most page views
d. The tendency of most webpage layouts to follow golden-ratio
proportions
Answer: B
10. The recommended number of participants needed for an exploratory
UX-interview:
a. Is the same as in usability testing (5)
b. Is the same as in quantitative studies (40)
c. Depends on how broad your research goals are
d. Depends on the size of your target audience
Answer: C
332
5. what is usability testing. UX Evaluation
https://www.youtube.com/watch?v=9vDqbOVuKhM
6. Usability Testing w. 5 Users.
https://www.youtube.com/watch?v=RhgUirqki50
7. Test Case Design Techniques.
https://www.youtube.com/watch?v=BSjRmiYP7vg
8. Usability Testing Tips & Tools: Powerful UX Research Method.
https://www.youtube.com/watch?v=RyGFEmimwoM
9. UX Evaluation.
https://www.youtube.com/watch?v=wN5v4NZODXY
333
13
DEVELOPING MOBILE APPLICATIONS
BASED ON UED PRINCIPLES
Unit Structure :
13.0 Introduction
13.1 Steps For Creating Mobile Application UED Design In FIGMA
13.2 Quiz
13.3 Moocs
13.4 Video Lectures
13.5 References
MINI PROJECT
13.0 INTRODUCTION
As compared to desktop application, mobile applications are becoming
more popular due to its compatibility and portability. The UED design
for mobile applications are important because it makes the users stay and
help businesses eventually earn loyal customers. A good UI helps load
the app faster and provides the users with a top-notch user experience in
terms of navigation, look and feel to widen the customer base. In the end,
it's all about making a trusted user base.
Here, we have shown a real-time project related to mobile application
development based on UED principle. So, for doing this we have used
online tool called Figma.
334
Click on New design file after login on figma website available on top Developing Mobile
left option. Applications Based
On UED Principles
335
Mobile Application and Step 4 - Set the frame color with hex color #F5FEC0 and set its
User experience Design Lab corner radius to 50 of frame property available on right side of figma
worksheet.
Step 5 - Now, put the image in centre of the frame and set its layer
property to multiply available on right side of figma worksheet.
Step 6 - After that create rectangle at last part of the frame using the
rectangle tool available on the top panel of figma worksheet and fill it
with hex color #126804 with 60% intensity.
336
Step 7 - Use pencil tool available at the panel top of figma worksheet Developing Mobile
in order to create vector shape above rectangle and fill it with hex Applications Based
color #126804 with intensity 60%. On UED Principles
337
Mobile Application and Step 10 - In 2nd rectangle draw order tracking button shape using
User experience Design Lab ellipse tool, in order to do it first take a large ellipse, then place
smaller ellipse in it and filled it with black color and also display
delivery time using text tool.
Step 11 - In 3rd rectangle draw buy button shape using ellipse tool,
also fill it with hex color #208A0E and also display the total price of
the fruit using text tool.
338
Step 12 - Select text tool available on top panel of figma worksheet Developing Mobile
for setting the text fruits above orange image with hex color Applications Based
#A67A46. On UED Principles
Step 13 - Set left arrow symbol (highlighted in red color box) using
arrow tool available on top panel of figma worksheet before text
fruits with same hex color, i.e. used for text fruits.
339
Mobile Application and Step 14 - Create ellipse (highlighted in red color box) using ellipse
User experience Design Lab tool available on top panel of figma worksheet and filled it with hex
color #208A0E.
Step 15 - Put add to cart icon (highlighted in red color box) into this
ellipse (mentioned above).
340
Step 17 - Now, below of this text THAI ORANGES place another Developing Mobile
text Fresh, ready to eat with hex color # 208A0E and set its intensity Applications Based
to 71%. On UED Principles
Step 18 - On other side of this text THAI ORANGES, place the price
of the Orange in the form of text i.e. $2 and on above of $2, place
another text i.e. /KILO with hex color #109709.
Final layout of this design will be:-
341
Mobile Application and 13.3 QUIZ
User experience Design Lab
1. Which of the following is golden rule for interface design?
a) Place the user in control
b) Reduce the user’s memory load
c) Make the interface consistent
d) All of the mentioned
Answer: d
2. Which of the following is not a design principle that allow the user to
maintain control?
a) Provide for flexible interaction
b) Allow user interaction to be interrupt-able and undo-able
c) Show technical internals from the casual user
d) Design for direct interaction with objects that appear on the screen
Answer: c
3. Which of the following is not a user interface design process?
a) User, task, and environment analysis and modeling
b) Interface design
c) Knowledgeable, frequent users
d) Interface validation
Answer: c
4. When users are involved in complex tasks, the demand on
__________ can be significant.
a) short-term memory
b) shortcuts
c) objects that appear on the screen
d) all of the mentioned
342
Answer: a Developing Mobile
Applications Based
5. Which of the following option is not considered by the Interface On UED Principles
design?
a) the design of interfaces between software components
b) the design of interfaces between the software and human producers
and consumers of information
c) the design of the interface between two computers
d) all of the mentioned
Answer: c
6. A software might allow a user to interact via
a) keyboard commands
b) mouse movement
c) voice recognition commands
d) all of the mentioned
Answer: d
7. A software engineer designs the user interface by applying an iterative
process that draws on predefined design principles.
a) True
b) False
Answer: a
8. What incorporates data, architectural, interface, and procedural
representations of the software?
a) design model
b) user’s model
c) mental image
d) system image
Answer: a
9. What establishes the profile of end-users of the system?
a) design model
b) user’s model
c) mental image
d) system image
Answer: b
343
Mobile Application and 10. What combines the outward manifestation of the computer-based
User experience Design Lab system , coupled with all supporting information that describe system
syntax and semantics?
a) mental image
b) interface design
c) system image
d) interface validation
Answer: c
13.4 MOOCS
1. Introduction to User Experience Principles and Processes. Coursera.
https://www.coursera.org/learn/introtoux-principles-and-
processes?specialization=michiganux&utm_medium=institutions&ut
m_source=umich&utm_content=sem&utm_campaign=adwords-ux-
introtoux-principles-and-
processes&utm_term=%2Bonline%20%2Bux%20%2Bcourse&gclid=
Cj0KCQjwmouZBhDSARIsALYcoursqTDlbReHRD4TIZPVd5D5o
V56o8qcmHBwPNjFlDSTAwOYlS2KttgaAmCpEALw_wcB
2. The Ultimate UI UX Design Course: Beginner to Pro. Knowledgehut.
https://www.knowledgehut.com/web-development/ui-ux-design-
bootcamp-
course?utm_source=google&utm_medium=cpc&utm_campaign=Indi
a-INR-IST-Desktop-Search-UIUX-MSV-
Exact_ui%20ux%20design%20course%20online_{adid}&gclid=Cj0K
CQjwmouZBhDSARIsALYcouoTLoxj7kUIN09bFj_bDYwQG4S08b
PH8jL6jD1tbZcdGfKjmZix-QUaApTPEALw_wcB
3. UI/UX Design Expert. SimpliLearn. https://www.simplilearn.com/ui-
ux-design-masters-program-certification-
course?utm_source=google&utm_medium=cpc&utm_term=ui%20ux
%20design%20course%20online&utm_content=18037681095-
145720773088-
616334220894&utm_device=c&utm_campaign=Search-
DigitalBusinessCluster-BusinessLeadership-UI-UX-OtherStates-IN-
Main-AllDevice-adgroup-UI-UX-Course-
Exact&gclid=Cj0KCQjwmouZBhDSARIsALYcoupBfgkro6uLGp0u1
ebZ3rAB0VBBWH3qpQmv3lFgJgqlIuibBu6wLEcaAtBFEALw_
wcB
4. User Experience Design Courses.Udemy.
https://www.udemy.com/courses/design/user-experience/.
344
13.5 VIDEO LECTURES Developing Mobile
Applications Based
1. UI/UX Complete Course | UI/UX Tutorial | UI/UX Training | On UED Principles
Intellipaat. https://www.youtube.com/watch?v=QeTbLkH64kQ
2. UI UX Tutorial For Beginners | UI UX Full Course | UI UX Training |
Intellipaat. https://www.youtube.com/watch?v=ONrvf5bjsF8
3. UI/UX Course | UI/UX Free Course | UI/UX Training | Intellipaat.
https://www.youtube.com/watch?v=spGDKJNq-EE
4. BEST UI/UX Design Guide 2022.
https://www.youtube.com/watch?v=keKQxadqnoA
5. UI/UX Development Introduction | UI/UX Design Tutorials.
https://www.youtube.com/watch?v=qDUYIQZVQDE&list=PLVlQH
NRLflP_5_vCknMsxLS-mTJgq1QzH
13.6 REFERENCES
1. https://www.sanfoundry.com/software-engg-mcqs-user-interface-
design/
2. "Fundamentals of Creating a Great UI/UX" . Creative Tim
3. "Refactoring UI". Steve Schoger & Adam Wathan
4. "Laws of UX: Using Psychology to Design Better Products &
Services". Jon Yablonski
5. "Don’t make me think". Steve Krug
6. "100 Things Every Designer Needs to Know About People". Susan
Weinschenk
7. "The Principles of Beautiful Web Design". Jason Beaird
345