1. FOOD RUNNER APP
A Project Report Submitted To
SANGAM UNIVERSITY, BHILWARA
Towards Partial Fulfillment for the Award of
Bachelor of Computer Application
Submitted By
Anshul Chechani (2018BCxx0260)
Under the Supervision of
Mr. Vikas Somani
Department of Computer Science and Engineering,
School of Engineering, Sangam University,
National Highway-79, Chittor By-Pass, Atoon, Bhilwara, Rajastham
2. CERTIFICATE
This is certified that project entitled “Title” submitted by Student Anshul
Chechani(2018BCXX0260) is a satisfactory account of the bonafide work done under our
supervision and is recommended towards partial fulfillment for the award of the degree
Bachelors of Computer Application in computer science to Sangam University,
Bhilwara(R.J.).
Date:
Project Guide:- HOD/Program Coordinator
Internshalla Trainings Mr.Abhishek Singh
Dean (Dr. Sunil Kumar)
School of Engineering
4. Acknowledgement
I am very much thankful to my Supervisor and all the members of my Advisory Committee for their
invaluable Suggestions along with guidelines , throughout my entire work in every aspect. I am also
verymuch thankful to Prof.(Dr.) K.P. Yadav , Hon’ble Vice Chancellor of Sangam University and also
to Hon’ble Chairman, Mr. Rampal Soni Of Sangam Group. I also express my sincere gratitude to Mr.
Abhishek Singh , Program Coordinator and Dr.Sunil Kumar , Dy. Dean and HOD , School of
Engineering , to provide opportunity to me To complete my Project work and for their. Invaluable
suggestions. Last but not the least, I express my thanks to all the faculty and staff members of Computer
Science and Engineering Department for their valuable supports. At last , I express my thanks and
gratitude to my parents, my entire family members and friends for the entire tenure.
Anshul Chechani(2018BCxx0260)
5. TABLE OF CONTENTS
Certificate 2
Certificate of Training 3
Acknowledgements 4
Table of Contents 5
Chapter 1 Introduction
1.1 Introduction to Project
1.2 Motivation
1.3 Objectives
1.4 Analysis
1.4.1 Functional Requirements
1.4.2 Non-Functional Requirements
Chapter 2 Background
Chapter 3 Design
3.1 Design Approach
3.2 Detailed Design
3.3 User- interface Design
Chapter 4 Implementation
4.1 Android
4.2 Android app
4.3 XML in Android
4.4 Android Architecture
4.5 Android Emulator
4.6 World of Kotlin
4.7 Android Building Blocks
4.8 Introduction to development tool Android Studio
4.9 Android UI Design
4.10 Different UI widget available in Android
4.11 Menus
4.12 Dialog box
4.13 Toast
6. 4.14 Adapters
4.15 Array adapters
4.16 Notification Manager
4.17 Database SQLite
4.18 SQLite open header
4.19 Query()
4.20 Opening and closing a database
4.21 Cursor
4.22 Insert
4.23 Delete
4.24 Content provider and sharing data
4.25 Food Runner App
4.26 Design
Chapter 5: Conclusion
Chapter 6: Bibliography
List of Tables
Table 1 Android Versions 15
Table 2 Components and Description 17
Table 3 Components and Description 19
Table 4 System Requirements 33
List of Figures
Figure 1 Home screen 14
Figure 2 Android 14
Figure 3 Android Features 15
Figure 4 UI Layouts 20
Figure 5 Android Architecture 25
Figure 6 Transition between activities 28
Figure 7 Life cycle of Activity 29
Figure 8 Food Runner App 42
Figure 9 Login Screen 43
Figure 10 Registration Screen 44
7. Figure 11 Entering new password 45
Figure 12 Entering OTP 46
Figure 13 Home screen 47
Figure 14 Menu bar 48
Figure 15 Sort by screen 49
Figure 16 My profile 50
Figure 17 My favorite 51
Figure 18 Order history 52
Figure 19 FAQs 53
Figure 20 Food items 54
Figure 21 Selecting Food Items 55
Figure 22 My Cart 56
Figure 23 Order placed successfully 57
Figure 24 Logout Screen 58
Abstract
8. ABSTRACT
The simplicity and ease of access of a menu are the main things that facilitate ordering food in a restaurant.
A Table menu completely revolutionizes the patron’s dining experience. Existing programs provide an app
that restaurants can use to feed their menus into Android based tablets and make it easier for the diners to
flip , swipe & tap through the menu. We here aim to provide the restaurants with a tablet menu that would
recommend dishes based on recommendation algorithm which has not been implemented elsewhere In
addition to this we run the app on a Android based tablet & not on an iOS based tablet which is more
expensive alternative. We use a cloud-based Server for storing the database which makes it inexpensive &
secure.The prime objective of “best Restaurant finder ”is to create a full fledged Android application which
could locate a list of restaurants based on the location & type of the cuisine entered by the user. The user
not only finds all the restaurants in the city, but also he can make a choice of the best restaurant based on
the rating & cuisine he chooses to have. They can also obtain the detailed review of the restaurant he
chooses . The Project is developed in Java Programming Language by using the Eclipse Ganymede
Integrated Development Environment (IDE).We use the Android Software Developmen Kit (SDK) which
includes a variety of custom tools that help us develop mobile applications on the Android platform. The
most important of these are the Android Emulator and the Android Development Tools (ADT) plug-in for
Eclipse.
9. Chapter 1 : Introduction
1.1 Introduction of project
I have completed my 8 weeks internship from Internshala . This project works is aimed for developing an
efficient food ordering system app named “Food Runner”. It is believed that still have a lot of restaurants
are using the traditional method for food ordering processes. By using the traditional method, it arise a lot
of human error while the restaurant’s employees deal with large amount of customers, this issue will did
a great impact to the restaurant in terms of profitability. Android app development is a process by which
applications are created for devices of Android operating system Google states that “Android apps can be
written using Kotlin, Java and C++ languages” using the Android Software Development Kit (SDK).
1.2 Motivation:
With attractive deals, coupons and discount offers, people tend to order food online very often and that is
Increasing day by day. An online food ordering system is the best and easy we can sit at any place and
Order the food items and also the best way is that it provide the door to door services. I designed this
food app because I want to learn something new and also I have much interest to learn the android and
also its working.
1.3 Objectives:
Provide convenience for both employees and consumers:-
The system will provide an experience of convenience to the restaurant employees while they are on
duty as well as the consumer who dine-in at the restaurant. This system allow the staff to serve
customers with the minimal delay compare to the paper based order system, because what the staff need
to do is just record down the food that the customer wish to order then the staff place an order via the
computer, the food order will be send to the kitchen computer simultaneously. After the order have been
successfully placed one copy of the food order with it details will be printed out for customer review. It
significantly shorten the time needed to take an order, assume that kitchen area is on ground floor but
currently the staff is taking order at second floor. If the restaurant is using paper- based system, the staff
has to deliver the food order to ground floor and walk all the way back to second floor, it take a lot of
time and time consuming.
1.4 Analysis:
10. 1.4.1 Functional Requirements:
The system shall only allow management level user to edit the menu card information by having an
authorization login checking.
The system shall allow user to update their restaurant menu card information.
The system shall save the updated menu card information to the database.
1.4.2 Non-Functional Requirements:
The system should validate the username and password in order to login and make changes to the
system.
The system should request the current password of the user in order to let them change to a new
password.
The system should let user to place an order in a short period of time.
The system should complete perform the billing process in a short period of time.
11. Chapter 2: Background
Android refers to mobile operating system which is developed by Google and is based on the Linux Kernel.
Its main use is for touch screen mobile devices such as smart phones and tablets, but it can also be used to
make specialized user interfaces for televisions and wrist watches. Google have released Android’s source
code under open source licenses , which means that it is free for everybody to access. This has resulted in a
larger community of developers using the open - source code as a foundation for community - driven projects.
Android’s success has gotten it involved with the “Smartphone wars” between technology companies.In 2005,
the next big chapter in Android’s history began when the original company was acquired by Google. Rubin
and other founding members stayed on to continue developing the OS under their new owners. The decision
was made to use Linux as the basis for the Android OS. That meant that the operating system could be offered
to third-party mobile phone manufacturers for free. Google and the Android team felt the company could make
money offering other services that used the OS , including apps.Rubin stayed at Google as head of the Android
team until 2013, when the Mountain View company announced he would be leaving the division. In late 2014,
Rubin left Google altogether and launched a start-up business incubator before eventually returning to the smart
phone business with the in 2017.
12. Chapter 3: Design
3.1 Design Approach:
This project is based on the functional design approach, which helps in understanding the design of the
project in a simpler way by explaining its flow , use cases, and implementation more like a modular
approach. For example , there are different modules in this project which have separate functionality
and , other sub functionalities / modules. All the modules are designed , implemented and integrated
together to make a flawless working application.
3.2 Detailed Design:
The detailed design including modules and sub modules of the application is as follows:-
3.2.1 User –Registration:
If the user wants to use the Food Runner, they must download the application from the play store,
install and register it by providing login information. Once, they registers the registered information is
stored on the server and can be validated, checking the valid credentials for the next time user logins
with the application.
3.2.2 Instant-Search:
The instant search helps in finding whether the restaurant is available or not. This could help the users
to save time by searching for particular restaurant having their favorite food items is available or not.
3.2.3 Sort-by:
The sort-by option changes the sequence of the restaurants but doesn’t exclude any restaurant. It
enables the users to see items that fall outside their initial boundary.
It has 3 category:-
Cost(Low to High)
Cost(High to Low)
Rating
3.2.4 Checkout and Payment:
13. The user can check in with the checkbox from the cart. Depending upon the quantity of the items, the
payment is calculated. If the user wishes to purchase, they can proceed by clicking the “Place Order”
button or they can cancel the order at this stage and proceed with ordering another food item or they
can exit the application.
3.2.5 Favorite:
The user can add restaurants to their favorites, making it easy for them to track of all the restaurants
with their favorite food items they desire or keep a wish list for future ordering. The favorite option
can be enabled and disabled as per the user’s choice.
3.3 User-Interface Design:
User - Interface Design for any application should be simple. In this application, there are two main
screens, the Login screen and Home screen. The Login page is the first page which appears when the
user uses the application. In that page, if the user is new, then the user can sign up or if he is an existing
user, he can login with the credentials. The next screen is the Home page screen where the users can
select features and use the application.
15. Chapter 4: Implementation
4.1 Android:
Android is an open source and Linux-based Operating System for mobile devices such as
smartphones and tablet computers. Android was developed by the Open Handset Alliance,
led by Google, and other companies.
Android offers a unified approach to application development for mobile devices which
means developers need only develop for Android, and their applications should be able to
run on different devices powered by Android.
The first beta version of the Android Software Development Kit (SDK) was released by
Google in 2007 where as the first commercial version, Android 1.0, was released in
September 2008.
Android is an OS created by Google® for use on mobile devices, such as smartphones and
tablets. It's available on devices made by a variety of manufacturers, giving you more
choices of device style and pricing. Also, with the Android OS, you can customize your
device in many ways.
Figure 3: Android Features
16. CODE NAME VERSION NUMBER INITIAL RELEASE DATE
N/A 1.0 Sept. 23,2008
Petit Four 1.1 Feb. 09,2009
Cupcake 1.5 April 27, 2009
Donut 1.6 Sept. 15, 2009
Éclair 2.0-2.1 Oct. 26, 2009
Froyo 2.2-2.2.3 May 20, 2010
Ginger Bread 2.3-2.3.7 Dec. 06, 2010
Honeycomb 3.0-3.2.6 Feb. 22, 2011
Ice Cream Sandwich 4.0-4.0.4 Oct. 18, 2011
Jelly Bean 4.1-4.3.1 July 09, 2012
KitKat 4.4-4.4.4 Oct. 31, 2013
Lollipop 5.0-5.1.1 Nov.12, 2014
Marshmallow 6.0-6.0.1 Oct.05, 2015
Nougat 7.0-7.1.2 Aug.22, 2016
Oreo 8.0-8.1 Aug.21, 2017
Pie 9.0 Aug.06, 2018
Table 1: Android Versions
Android has been the best-selling OS worldwide on smartphones since 2011 and on tablets
since 2013. As of May 2017, it has over two billion monthly active users, the largest installed
base of any operating system, and as of August 2020, the Google Play Store features over
3 million apps.
4.2 Android App
Android App is a software designed to run on an Android device or emulator. The term also
refers to an APK file which stands for Android package. This file is a Zip archive containing
app code, resources, and meta information.Android apps can be written in Kotlin, Java, and
C++ and are run inside Virtual Machine. The official development environment is Android
Studio.
17. Application components are the essential building blocks of an Android application. These
components are loosely coupled by the application manifest file AndroidManifest.xml that
describes each component of the application and how they interact.
There are following four main components that can be used within an Android application −
S.No Components & Description
1
Activities
They dictate the UI and handle the user interaction to the smart phone screen.
2
Services
They handle background processing associated with an application.
3
Broadcast Receivers
They handle communication between Android OS and applications.
4
Content Providers
They handle data and database management issues.
Table 2: Components and Description
Activities
An activity represents a single screen with a user interface,in-short Activity performs actions
on the screen. For example, an email application might have one activity that shows a list of
new emails, another activity to compose an email, and another activity for reading emails. If
an application has more than one activity, then one of them should be marked as the activity
that is presented when the application is launched.
18. An activity is implemented as a subclass of Activity class as follows −
publicclassMainActivityextendsActivity{
}
Services
A service is a component that runs in the background to perform long-running operations.
For example, a service might play music in the background while the user is in a different
application, or it might fetch data over the network without blocking user interaction with an
activity.
A service is implemented as a subclass of Service class as follows −
publicclassMyServiceextendsService{
}
Broadcast Receivers
Broadcast Receivers simply respond to broadcast messages from other applications or from
the system. For example, applications can also initiate broadcasts to let other applications
know that some data has been downloaded to the device and is available for them to use, so
this is broadcast receiver who will intercept this communication and will initiate appropriate
action. A broadcast receiver is implemented as a subclass of BroadcastReceiver class and
each message is broadcaster as an Intent object.
publicclassMyReceiverextendsBroadcastReceiver{
publicvoid onReceive(context,intent){}
}
Content Providers
A content provider component supplies data from one application to others on request. Such
requests are handled by the methods of the ContentResolver class. The data may be stored in
the file system, the database or somewhere else entirely. A content provider is implemented
as a subclass of ContentProvider class and must implement a standard set of APIs that
enable other applications to perform transactions.
19. publicclassMyContentProviderextendsContentProvider{
publicvoid onCreate(){}
}
We will go through these tags in detail while covering application components in individual
chapters.
Additional Components
There are additional components which will be used in the construction of above mentioned
entities, their logic, and wiring between them. These components are −
S.No Components & Description
1
Fragments: Represents a portion of user interface in an Activity.
2 Views: UI elements that are drawn on-screen including buttons, lists forms etc.
3 Layouts :View hierarchies that control screen format and appearance of the views.
4 Intents: Messages wiring components together.
5 Resources :External elements, such as strings, constants and drawable pictures.
6 Manifest : Configuration file for the application.
Table 3: Components and Description
4.3 XML in Android: Basics And Different XML Files Used In Android
20. XML stands for Extensible Markup Language. XML is a markup language much
like HTML used to describe data. XML tags are not predefined in XML. We must define our
own Tags. Xml as itself is well readable both by human and machine. Also, it is scalable and
simple to develop. In Android we use xml for designing our layouts because xml is
lightweight language so it doesn’t make our layout heavy. In this article we will go through
the basic concepts of xml in Android and different XML files used for different purpose in
Android. This will help you in writing a UI code to design your desired user interface.
Table Of Contents :
Basics Of User Interface:
Different XML Files Used in Android:
Basic of user Interface:
The whole concept of Android User Interface is defined using the hierarchy of View and
ViewGroup objects. A ViewGroup is an invisible container that organizes child views. These
child views are other widgets which are used to make the different parts of UI. One
ViewGroup can have another ViewGroup as an child element as shown in the figure given
below:
Figure 4:UI Layouts
21. Different XML Files Used in Android:
In Android there are several xml files used for several different purposes. Below we define
each and every one.
Layout XML Files: Layout xml files are used to define the actual UI(User interface)
of our application. It holds all the elements(views) or the tools that we want to use in
our application. Like the TextView’s, Button’s and other UI elements.
Manifest xml File(Mainfest.xml): This xml is used to define all the components of
our application. It includes the names of our application packages, our Activities,
receivers, services and the permissions that our application needs. For Example –
Suppose we need to use internet in our app then we need to define Internet
permission in this file.
Strings xml File(strings.xml): This xml file is used to replace the Hard-coded
strings with a single string. We define all the strings in this xml file and then access
them in our app(Activity or in Layout XML files) from this file. This file enhance
the reusability of the code.
Styles xml File(styles.xml): This xml is used to define different styles and looks for
the UI(User Interface) of application. We define our custom themes and styles in this
file.
Drawable xml Files: These are those xml files that are used to provide various
graphics to the elements or views of application. When we need to create a custom
UI we use drawable xml files. Suppose if we need to define a gradient color in the
background of Button or any custom shape for a view then we create a Drawable xml
file and set it in the background of View.
Color xml File (colors.xml): This file is used to define the color codes that we used
in our app. We simply define the color’s in this file and used them in our app from
this file.
Dimension xml File(dimens.xml): This xml file is used to define the dimensions of
22. the View’s. Suppose we need a Button with 50dp(density pixel) height then we
define the value 50dp in dimens.xml file and then use it in our app from this file.
4.4 Android Architecture
Android operating system is a stack of software components which is roughly divided into
five sections and four main layers as shown below in the architecture diagram.
Linux kernel
At the bottom of the layers is Linux - Linux 3.6 with approximately 115 patches. This
provides a level of abstraction between the device hardware and it contains all the
essential hardware drivers like camera, keypad, display etc. Also, the kernel handles all
the things that Linux is really good at such as networking and a vast array of device
drivers, which take the pain out of interfacing to peripheral hardware.
Libraries
On top of Linux kernel there is a set of libraries including open-source Web browser engine
WebKit, well knownlibrary libc, SQLite database which is a useful repository for storage and
sharing of application data, libraries to play and record audio and video, SSL libraries
responsible for Internet security etc. The on top of a Linux kennel there is a set of libraries
including open-source web browsers such as WebKit , library libc. These libraries are used to
play and record audio and video. The SQLite is a database that is useful for the storage and
sharing of application data. The SSL libraries are responsible for internet security etc.
Android Libraries
This category encompasses those Java-based libraries that are specific to Android
development. Examples of libraries in this category include the application framework
libraries in addition to those that facilitate user interface building, graphics drawing and
database access. A summary of some key core Android libraries available to the
Android developer is as follows −
android.app − Provides access to the application model and is the cornerstone of all
Android applications.
23. android.content − Facilitates content access, publishing and messaging between
applications and
application components.
android.database − Used to access data published by content providers and includes
SQLite database management classes.
android.opengl − A Java interface to the OpenGL ES 3D graphics rendering API.
android.os − Provides applications with access to standard operating system services
including messages,system services and inter-process communication.
android.text − Used to render and manipulate text on a device display.
android.view − The fundamental building block of application user interfaces.
android.widget − A rich collection of pre-built user interface components such as
buttons, labels, list views, layout managers, radio buttons etc.
android.webkit − A set of classes intended to allow web-browsing capabilities to be
built into applications.
Having covered the Java-based core libraries in the Android runtime, it is now time to turn
our attention to the C/C++ based libraries contained in this layer of the Android software
stack.
Android Runtime
This is the third section of the architecture and available on the second layer from the bottom.
This section provides a key component called Dalvik Virtual Machine which is a kind of Java
Virtual Machine specially designed and optimized for Android. The Dalvik VM makes use of
Linux core features like memory management and multithreading, which is intrinsic in the
Java language. The Dalvik VM enables every Android application to run in its own process,
with its own instance of the Dalvik virtual machine. The Android runtime also provides a set
of core libraries which enable Android application developers to write Android applications
using standard Java programming language The android runtime provides a key component
called Dalvik Virtual Machine which is a kind of java virtual machine. It is specially
designed and optimized for android. The Dalvik VM is the process virtual machine in the
android operating system. It is a software that runs apps on android devices.The Dalvik VM
makes use of Linux core features like memory management and multithreading which is in
24. java language. The Dalvik VM enables every Android application to run its own process. The
Dalvik VM executes the files in the .dex format.
Application Framework
The Application Framework layer provides many higher-level services to applications in the
form of Java classes. Application developers are allowed to make use of these services in
their applications. The Android framework includes the following key services −
Activity Manager - Controls all aspects of the application lifecycle and activity stack.
Content Providers - Allows applications to publish and share data with other
applications.
Resource Manager - Provides access to non-code embedded resources such as strings,
color settings and user interface layouts.
Notifications Manager - Allows applications to display alerts and notifications to the
user.
View System - An extensible set of views used to create application user interfaces.
Applications and Features:
You will find all the Android application at the top layer. You will write your application to
be installed on this layer only. Examples of such applications are Contacts Books, Browser,
and Games.You will find all the android applications at the top layer and you will write your
application and install it on this layer. Examples of such applications are contacts, books,
browsers, services, etc. Each application performs a different role in the overall applications.
Features:
Headset layout
Storage
Connectivity: GSM/EDGE, IDEN, CDMA, Bluetooth, WI-FI, EDGE,3G,NFC,
LTE,GPS.
Messaging: SMS, MMS, C2DM (could to device messaging), GCM (Google could
messaging)
Multilanguage support
Multi-touch
25. Video calling
Screen capture
External storage
Streaming media support
Optimized graphics
Figure 5: Android Arrchitecture
4.5 Android Emulator:
The Emulator is a new application in the Android operating system. The emulator is a new
prototype that is used to develop and test android applications without using any physical
device.
4.6 World of Kotlin
Kotlin is an open-source, statically-typed programming language that supports both object-
oriented and functional programming. Kotlin provides similar syntax and concepts from other
26. languages, including C#, Java, and Scala, among many others. Kotlin does not aim to be
unique—instead, it draws inspiration from decades of language development. It exists in
variants that target the JVM (Kotlin/JVM), JavaScript (Kotlin/JS), and native code
(Kotlin/Native). Kotlin's interoperability with Java means that you don’t have to adopt Kotlin
all at once. You can have projects with both Kotlin and Java code. For more information on
adding Kotlin to an existing app, see Add Kotlin to an existing app. If you are a part of a
larger team, the size of your organization and codebase may necessitate special focus. For
tips and other information, see Adopt Kotlin for large teams.
Using Kotlin for Android Development
Using Kotlin for Android development, you can benefit from:
Less code combined with greater readability. Spend less time writing your code and
working to understand the code of others.
Mature language and environment. Since its creation in 2011, Kotlin has developed
continuously, not only as a language but as a whole ecosystem with robust tooling. Now
it's seamlessly integrated in Android Studio and is actively used by many companies for
developing Android applications.
Kotlin support in Android Jetpack and other libraries. KTX extensions add Kotlin
language features, such as coroutines, extension functions, lambdas, and named
parameters, to existing Android libraries.
Interoperability with Java. You can use Kotlin along with the Java programming
language in your applications without needing to migrate all your code to Kotlin.
Support for multiplatform development. You can use Kotlin for developing not only
Android but also iOS, backend, and web applications. Enjoy the benefits of sharing the
common code among the platforms.
Code safety. Less code and better readability lead to fewer errors. The Kotlin compiler
detects these remaining errors, making the code safe.
Easy learning. Kotlin is very easy to learn, especially for Java developers.
Big community. Kotlin has great support and many contributions from the community,
which is growing all over the world. According to Google, over 60% of the top 1000
27. apps on the Play Store use Kotlin.
4.7 Android Building Blocks
Each building block is a different point through which the system can enter your application.
Not all components are actual entry points for the user and some depend on each other, but
each one exists as its own entity and plays a specific role—each one is a unique building
block that helps define your application's overall behavior.
Activities
An activity is an application component that provides a screen with which users can interact
in order to do something, such as dial the phone, take a photo, send an email, or view a map.
Each activity is given a window in which to draw its user interface. The window typically
fills the screen, but may be smaller than the screen and float on top of other windows. An
application usually consists of multiple activities that are loosely bound to each other.
Typically, one activity in an application is specified as the "main" activity, which is presented
to the user when launching the application for the first time. Each activity can then start
another activity in order to perform different actions. Each time a new activity starts, the
previous activity is stopped, but the system preserves the activity in a stack (the "back
stack"). When a new activity starts, it is pushed onto the back stack and takes user focus. The
back stack abides to the basic "last in, first out" stack mechanism, so, when the user is done
with the current activity and presses the Back button, it is popped from the stack (and
destroyed) and the previous activity resumes. When an activity is stopped because a new
activity starts, it is notified of this change in state through the activity's lifecycle callback
methods. There are several callback methods that an activity might receive, due to a change
in its state whether the system is creating it, stopping it, resuming it, or destroying it—and
each callback provides you the opportunity to perform specific work that's appropriate to that
state change. For instance, when stopped, your activity should release any large objects, such
as network or database connections. When the activity resumes, you can reacquire the
necessary resources and resume actions that were interrupted. These state transitions are all
part of the activity lifecycle.
29. Figure 7: Lifecycle of an activity
Services
A service is an application component that can perform long-running operations in the
background, and it does not provide a user interface. Another application component can start
a service, and it continues to run in the background even if the user switches to another
application. Additionally, a component can bind to a service to interact with it and even
perform inter process communication (IPC). For example, a service can handle network
transactions, play music, perform file I/O, or interact with a content provider, all from the
background. These are the three different types of services:
Scheduled
30. A service is scheduled when an API such as the JobScheduler, introduced in Android 5.0
(API level 21), launches the service. You can use the JobScheduler by registering jobs and
specifying their requirements for network and timing. The system then gracefully schedules
the jobs for execution at the appropriate times. The JobScheduler provides many methods to
define service-execution conditions.
Started
A service is started when an application component (such as an activity) calls startService().
After it's started, a service can run in the background indefinitely, even if the component that
started it is destroyed. Usually, a started service performs a single operation and does not
return a result to the caller. For example, it can download or upload a file over the network.
When the operation is complete, the service should stop itself.
Bound
A service is bound when an application component binds to it by calling bindService(). A
bound service offers a client-server interface that allows components to interact with the
service, send requests, receive results, and even do so across processes with inter process
communication (IPC). A bound service runs only as long as another application component is
bound to it. Multiple components can bind to the service at once, but when all of them
unbind, the service is destroyed.
Content Providers
A content provider manages a shared set of application data. You can store the data in the file
system, an SQLite database, on the web, or any other persistent storage location your
application can access. A content provider provides a structured interface to application data.
Via a content provider your application can share data with other applications. Android
contains an SQLite database which is frequently used in conjunction with a content provider.
Broadcast Receivers
Broadcast Receivers simply respond to broadcast messages from other applications or from
the system itself. These messages are sometime called events or intents. For example,
31. applications can also initiate broadcasts to let other applications know that some data has
been downloaded to the device and is available for them to use, so this is broadcast receiver
who will intercept this communication and will initiate appropriate action.
Intent
Intents are asynchronous messages which allow the application to request functionality from
other Android components, e.g. from services or activities. An application can call a
component directly (explicit Intent) or ask the Android system to evaluate registered
components based on the intent data (implicit intents). For example the application could
implement sharing of data via an intent and all components which allow sharing of data
would be available for the user to select. Applications register themselves to an intent via an
intent. Filter Intents allow an Android application to start and to interact with components
from other Android applications.
Using intent to launch the activities
There are separate methods for activating each type of component:
You can start an activity (or give it something new to do) by passing Intent to
startActivity() or startActivityForResult() .
You can start a service (or give new instructions to an ongoing service) by passing
an Intent tostartService(). Or you can bind to the service by passing an Intent to
bindService().
You can initiate a broadcast by passing an Intent to methods like sendBroadcast(),
sendOrderedBroadcast(),or sendStickyBroadcast().
You can perform a query to a content provider by calling query on a
ContentResolver.
4.8 Introduction to the Development tool “Android Studio”
Android Studio is the official integrated development environment (IDE) for Android
platform development. Android Studio is freely available under the apache license. Android
Studio is designed specifically for Android development. Android application development
32. can be started on either of the following operating systems –
Microsoft® Windows® 8/7/Vista/2003 (32 or 64-bit).
Mac® OS X® 10.8.5 or higher, up to 10.9 (Mavericks).
GNOME or KDE desktop.All the required tools to develop Android applications are
open source and can be downloaded from the Web.
Following is the list of softwares that is needed before starting Android application
programming.
Java JDK5 or later version
Java Runtime Environment (JRE) 6
Android Studio
Features:
The following features are provided in the current stable version:
Gradle-based build support
Android-specific refactoring and quick fixes
Lint tools to catch performance, usability, version compatibility and other problems
ProGuard integration and app-signing capabilities
Template-based wizards to create common Android designs and components
A rich layout editor that allows users to drag-and-drop UI components, option to preview
layouts on multiple screen configurations[17]
Support for building Android Wear apps
Built-in support for Google Cloud Platform, enabling integration with Firebase Cloud
Messaging (Earlier 'Google Cloud Messaging') and Google App Engine[18]
Android Virtual Device (Emulator) to run and debug apps in the Android studio.
Android Studio supports all the same programming languages of IntelliJ (and CLion)
e.g. Java, C++, and more with extensions, such as Go; and Android Studio 3.0 or later
supports Kotlin and "all Java 7 language features and a subset of Java 8 language features
that vary by platform version." External projects backport some Java 9 features. While
IntelliJ states that Android Studio supports all released Java versions, and Java 12, it's not
clear to what level Android Studio supports Java versions up to Java 12 (the documentation
mentions partial Java 8 support). At least some new language features up to Java 12 are
33. usable in Android.
System requirements
Basic system requirements for Android Studio
Microsoft Windows Mac Linux
Operating System
Version
Microsoft® Windows®
7/8/10 (32- or 64-bit)
The Android Emulator only
supports 64-bit Windows.
Mac® OS X® 10.10
(Yosemite) or higher,
up to 10.14 (macOS
Mojave)
GNOME or KDE desktop
Tested on gLinux based on
Debian (4.19.67-2rodete2).
Random Access
Memory (RAM)
4 GB RAM minimum; 8 GB RAM recommended.
Free disk space
2 GB of available disk space minimum, 4 GB Recommended (500 MB for IDE +
1.5 GB for Android SDK and emulator system image).
Minimum
required JDK
version
Java Development Kit 8
Minimum screen
resolution
1280 x 800
Table 4: System Requirements
The Android Emulator has additional requirements beyond the basic system requirements for
Android Studio, which are described below:
SDK Tools 26.1.1 or higher;
64-bit processor;
Windows: CPU with UG (unrestricted guest) support;
Intel Hardware Accelerated Execution Manager (HAXM) 6.2.1 or later (HAXM 7.2.0 or
later recommended).
The use of hardware acceleration has additional requirements on Windows and Linux:
34. Intel processor on Windows or Linux: Intel processor with support for Intel VT-x, Intel
EM64T (Intel 64), and Execute Disable (XD) Bit functionality;
AMD processor on Linux: AMD processor with support for AMD Virtualization (AMD-
V) and Supplemental Streaming SIMD Extensions 3 (SSSE3);
AMD processor on Windows: Android Studio 3.2 or higher and Windows 10 April 2018
release or higher for Windows Hypervisor Platform (WHPX) functionality.
To work with Android 8.1 (API level 27) and higher system images, an attached webcam
must have the capability to capture 720p frames.
4.9 Android UI Design
4.9.1 Introducing Layouts
Frame Layout
Frame layouts are one of the simplest layout types used to organize controls within the user
interface of an Android application. They are used less often than some other layouts, simply
because they are generally used to display only one view, or views which overlap. The
efficiency of a frame layout makes it a good choice for screens containing few view controls
(home screens, game screens with a single canvas, and the like). Sometimes other inefficient
layout designs can be reduced to a frame layout design that is more efficient, while other
times a more specialized layout type is appropriate. Frame layouts are the normal layout of
choice when you want to overlap views.
Linear Layout
Linear layouts are one of the simplest and most common types of layouts used by Android
developers to organize controls within their user interfaces. The linear layout works much as
its name implies: it organizes controls linearly in either a vertical or horizontal fashion. When
the layout’s orientation is set to vertical, all child controls within it are organized in a single
column; when the layout’s orientation is set to horizontal, all child controls within it are
organized in a single row. Some of the most important attributes you’ll use with linear
35. layouts include:
The orientation attribute (required), which can be set to vertical or horizontal.
The gravity attribute (optional), which controls how all child controls are aligned and
displayed within the linear layout (class: LinearLayout).
The layout_weight attribute (optional, applied to each child control) specifies each
child control’s relative importance within the parent linear layout (class:
LinearLayout.LayoutParams).
Relative Layout
The relative layout works much as its name implies: it organizes controls relative to one
another, or to the parent control itself. It means that child controls, such as ImageView,
TextView, and Button controls, can be placed above, below, to the left or right, of one
another. Child controls can also be placed in relation to the parent (the relative layout
container); including placement of controls aligned to the top, bottom, left or right edges of
the layout. Some specific attributes apply to relative layouts-namely the child rules,
including:
Rules for child control centering within the parent layout,
including: center horizontally, center vertically, or both.
Rules for child control alignment within the parent layout,
including: align with top, bottom, left or right edge of another
control.
Rules for child control alignment in relation to other child
controls, including: align with top, bottom, leftor right edge.
Rules for child control placement in relation to other child
controls, including: placement to the left or right of a specific
control, or above or below another control.
Table Layout
A table layout is exactly what you might expect: a grid of made up of rows and columns,
where a cell can display a view control. From a user interface design perspective, a
36. TableLayout is comprised of TableRow controls—one for each row in your table. The
contents of a TableRow are simply the view controls that will go in each “cell” of the table
grid. Although table layouts can be used to design entire user interfaces, they usually aren’t
the best tool for doing so, as they are derived from LinearLayout and not the most efficient of
layout controls. However, for data that is already in a format suitable for a table, such as
spreadsheet data, table layout may be a reasonable choice.
4.10 Different UI widgets available in Android
Text View
Edit Text
List View
Spinner
Button
Check Box
Radio Button
Scroll View
4.11 Menus
Options menu and action bar
The options menu is the primary collection of menu items for an activity. It's where you
should place actions that have a global impact on the app, such as “Search”, “Compose
email”, and “Settings”. On Android 3.0 and higher, items from the options menu are
presented by the action bar as a combination of on-screen action items and overflow options.
Beginning with Android 3.0, the Menu button is deprecated (some devices don't have one), so
you should migrate toward using the action bar to provide access to actions and other options.
Context Menu and Contextual Action Mode
A context menu is a floating menu that appears when the user performs a long-click on an
37. element. It provides actions that affect the selected content or context frame. A contextual
menu offers actions that affect a specific item or context frame in the UI. You can provide a
context menu for any view, but they are most often used for items in a ListView, GridView,
or other view collections in which the user can perform direct actions on each item.
Popup Menu
A popup menu displays a list of items in a vertical list that's anchored to the view that
invoked the menu. It's good for providing an overflow of actions that relate to specific
content or to provide options for a second part of a command.
4.12 Dialog Box
A dialog is a small window that prompts the user to make a decision or enter additional
information. A dialog does not fill the screen and is normally used for modal events that
require users to take an action before they can proceed.
4.13 Toast
A toast provides simple feedback about an operation in a small popup. It only fills the amount
of space required for the message and the current activity remains visible and interactive.
4.14 Adapters
An Adapter acts as a bridge between a ListView and the underlying data for that view. The
Adapter provides access to the data items. The Adapter is also responsible for making a View
for each item in the data set.
4.15 Array Adapter
Array Adapter is a concrete BaseAdapter that is backed by an array of arbitrary objects. By
default this class expects that the provided resource id references a single TextView. If you
want to use a more complex layout, use the constructor that also takes a field id. That field id
38. should reference a TextView in the larger layout resource.
4.16 Notification Manager
A notification is a message you can display to the user outside of your application's normal
UI. When you tell the system to issue a notification, it first appears as an icon in the
notification area. To see the details of the notification, the user opens the notification drawer.
Notification Manager Class is used to notify the user of events that happen. This is how you
tell the user that something has happened in the background. Notifications can take different
forms:
A persistent icon that goes in the status bar and is accessible through the launcher,
(when the user selects it,a designated Intent can be launched).
Turning on or flashing LEDs on the device.
Alerting the user by flashing the backlight, playing a sound, or vibrating.
4.17 Database SQLite
SQLite is an Open Source database. SQLite supports standard relational database features
like SQL syntax, transactions and prepared statements. The database requires limited memory
at runtime (approx. 250 Kbytes) which makes it a good candidate from being embedded into
other runtimes. SQLite is embedded into every Android device. Using a SQLite database in
Android does not require a setup procedure or administration of the database. We only have
to define the SQL statements for creating and updating the database. Afterwards the database
is automatically managed for us by the Android platform. If our application creates a
database, this database is by default saved at directory - DATA/data /APP_NAME/ databases
/FILENAME. SQLiteDatabase is the base class for working with a SQLite database in
Android and provides methods to open, query, update and close the database.
SQLiteDatabase provides the insert(), update() and delete() methods.
The object ContentValues allows to define key/values. The key represents the table
column identifier and the value represents the content for the table record in this
column. ContentValues can be used for inserts and updates of database entries.
39. Queries can be created via the rawQuery() and query() methods or via the
SQLiteQueryBuilder class .
rawQuery() directly accepts an SQL select statement as input.
query() provides a structured interface for specifying the SQL query.
SQLiteQueryBuilder is a convenience class that helps to build SQL queries.
4.18 SQLite Open Helper
To create and upgrade a database in our Android application we create a subclass of the
SQLite Open Helper class. In the constructor of our subclass we call the super() method of
SQLiteOpenHelper, specifying the database name and the current database version. In this
class we need to override the following methods to create and update our database-
onCreate() is called by the framework, if the database is accessed but not yet created.
onUpgrade() called, if the database version is increased in your application code.
This method allows you to update an existing database schema or to drop the existing
database and recreate it via the onCreate() method.
4.19 Query()
The following gives an example of a query() callreturn
database.query(DATABASE_TABLE, new String[] { KEY_ROWID, KEY_CATEGORY,
KEY_SUMMARY, KEY_DESCRIPTION }, null, null, null, null, null);
4.20 Opening and Closing a Database
SQLiteDatabase db = this.getWritableDatabase(); //Opening DatabaseConnection
ContentValues values = new ContentValues();
40. values.put(KEY_NAME, contact.getName()); //Contact Name
values.put(KEY_PH_NO, contact.getPhoneNumber()); //Contact Phone Number
db.insert(TABLE_CONTACTS, null, values); //Inserting Row
db.close(); //Closing database connection
4.21 Cursor
Cursor provides typed get*() methods, e.g. getLong(columnIndex), getString(columnIndex)
to access the column data for the current position of the result. The "columnIndex" is the
number of the column you are accessing. A Cursor needs to be closed with the close()
method call.
4.22 Insert
ContentValues values = new ContentValues();
values.put(MySQLiteHelper.COLUMN_COMMENT, comment);
long insertId = database.insert(MySQLiteHelper.TABLE_COMMENTS, null, values);
cursor.close();
return newComment;
4.23 Delete
database.delete(MySQLiteHelper.TABLE_COMMENTS, MySQLiteHelper.COLUMN_ID +
" = " + id, null);
4.24 Content provider and Sharing data
A SQLite database is private to the application which creates it. If you want to share data
with other applications you can use a content provider. A content provider allows
applications to access data. In most cases this data is stored in anSQlite database. While a
content provider can be used within an application to access data, its is typically used to share
41. data with other application. As application data is by default private, a content provider is a
convenient to share your data with other application based on a structured interface. A
content provider must be declared in the AndroidManifest.xml file.
4.25 Introduction Of Food Runner App:-
An Online Food Delivery Business is the one which takes online orders from customers on
the system and transfer those orders to a restaurant/food production unit, followed by delivery
boys picking up the orders and delivering to customer’s destination. With the core concept of
the system remains for the convenience for the customers, online food startups do not control
food quality. With people now wanting everything to be delivered at doorstep, delivery has
become the major segment of food industry. To stay ahead of competitors, you need to be
loaded with technology, demanding a strong presence on mobiles and web.Get a mobile app
built which will provide a platform to the food outlets where various food related services
will be provided As having a food application will correlate with all the challenges and hence
health and hygiene will be maintained.
Application will contain the following features :
• Increases brand value and Widens Your Reach
• Increases your target audience
• Makes you visible 24X7
• Easy ordering, payments and tracking
• Saves employees’ time and increases productivity
• Instant customer support
• Delights of a restaurant app to customers
• Easy ordering and home delivery
• Discounts, offers and loyalty points
• Easy payment options
4.26 Design:-
42. Figure 8 : Food Runner App (In the given below picture are
food runner is name of the app)
43. Figure 9 : Login Screen (In the picture below food runner open show first page
of login panel and register in the sign up:)
44. Figure 10: Registration Screen(Register of an app like given below name, email id ,
mobile number , address and password:-)
45. Figure 11: Entering New Password (If user forget password so like this steps for
the new password :-)
59. Chapter 5:Conclusion
I have learned a lot from this project on how to develop Android Application and publishing
it in real time, use web services using SOAP UI, reporting using chart libraries ,other
liabraries for scanning ,payment ,SDKs ,requirements gathering ,barcode ,QR ,RFID formats
As mentioned , other existing applications does not help in avoiding people to stand I a long
checkout line, instantly searching about availability of products ,tracking purchases (all
together in a single application). If people use Runner App in the future,they have several
advantages which includes, easy checkout, payment, sharing invoices, instantly as it is quite
easy to misplace paper bills and organizing them in easily particularly helpful for elderly
people by avoiding them to wait for a long time in the checkout line, providing quick
information about items available, tracking purchases which helps users to budget their
expenses wisely and finally stores can reduces scanning machinery and power consumption.