Professional Documents
Culture Documents
1. INTRODUCTION
The purpose of online food ordering system is to automate the existing manual system by the
help of computerized equipments and full-fledged computer software, fulfilling their
requirements, so that their valuable data/information can be stored for a longer period with easy
accessing and manipulation of the same. The required software and hardware are easily available
and easy to work with. Online food ordering system, as described above, can lead to error free
secure, reliable and fast management system. It can assist the user to concentrate on their other
activities rather to concentrate on the record keeping. The organization can maintain
computerized records without redundant entries. That means that one need not be distracted by
information’s that is not relevant, while being able to reach the information’s. The aim is to
automated its existing manual system by the help of computerized equipments and fully fledged
computer software, fulfilling their requirements, so that their valuable data/information’s can be
stored for a longer period with easy accessing and manipulation of the same. Basically the
project describes how to manage for good performance and better services for the clients.
2. SYSTEM STUDY
With the increasing popularity of food delivery in colleges and universities, the traditional
telephone order food has become inconvenient to the customers and the food delivery store. The
online food ordering system provides convenience for the customers. It overcomes the
disadvantage of the traditional queuing system. This android application increases the takeaway
of foods than visitors. Therefore, this system enhances the speed and standardization of taking
the order from the customer. It provides a better communication platform. The user details are
noted electronically. Using this application, the customers need not go to the restaurant by
themselves, but they can order the meals through Android mobiles anywhere. In this system
there are four namely, Admin, Delivery boy, Restaurant manager and User. Admin can login,
manage restaurants by adding, updating and deleting, manage delivery person by adding,
updating and deleting. Admin can also check registered users and the orders total count. Delivery
boy can login and see the allotted orders, they can upload the status of the order whether it is
picked, on the way or delivered. Restaurant manager can login and update their restaurants
details, they can even check for reviews and ratings given by users. They can manage menu by
adding new items and deleting unwanted. Manager can manage orders by allotting to the
delivery boy, can update status of delivery. Manager can see the payment done by electronic
mode. Users can register and login. Users have option to choose the cuisine, hotels nearby. User
will get details of restaurants like name, location and reviews. Users can select the food from the
menu list, can add to favorites and can get processed further. User can view the history of their
orders and the current orders status. User have online payment options. User will get notification
of the order status.
In an existing system for giving any orders, a user should visit Hotels or Restaurants to know
about food items and then give orders and pay in advance or you need to select menu and place
an order on call. In this method time and manual work is required. Maintaining critical
information in the files and manuals is full of risk and tedious process. Tracking of Delivery is
not available in previous applications and Booking of a particular table in advance is also not
available. Customization of Order, Current status of the order is not available. Some systems
contain an outdated database that is Restaurant is closed, yet it shows on the application.
The application is an online food ordering system which consists of GPS option where the
application user can select the option to see the restaurants nearby his vicinity. It is mainly
implemented using Global Positioning System (GPS).Users with location-aware wireless devices
can query about their surroundings at any place, anytime[2]. This android application enables the
end users to register on the application, select the food from menu card and order food by an
android app. The User will receive a confirmation call, by selecting and ordering the food they
want to have. The results after selecting food from menu card will directly appear in web
application part on the system of a manager. By using this application the work of waiter is
reduced or we can say that work is nullified. The benefit is that if there is a rush in a restaurant
then there will be chances that the waiters will be unavailable and then the users can directly
order the food by using android application. The user is given Username and Password to Login.
The software requirements document is the specification of the system. It Should include both a
definition and requirements. It is useful in estimating cost, planning team activities and
performing tasks throughout the development activity.
4. SYSTEM DESIGN
System design represents the project diagrammatically using the logical shapes. Systems design
is the process of defining the architecture, components, modules, interfaces, and data for a
system to satisfy specified requirements. Systems design could be seen as the application of
systems theory to product development.
A module is a software component or part of a program that contains one or more routines.
One or more independently developed modules make up a program. An enterprise- level
software application may contain several different modules, and each module serves unique
and separate business operations. Modules make a programmer's job easy by allowing the
programmer to focus on only one area of the functionality of the software application.
Modules are typically incorporated into the program (software) through interfaces.
MODULES
ADMIN
USER
MODULE DESCRIPTION
ADMIN
Login
Admin is the head of our android application they having a unique user name and password for
login session.
Add food
Admin will add food categories and food details in these application all of the food related
information’s will be shared on to the customer.
View orders
In this module describe as admin can view all of the orders who can order the food and food
ordering details in to these application.
USERS
If the student first time enters into our application they will enters all the personal information’s
for the registration process after they will get an unique user name and password for a login
session.
View food
In these modules describe as if every users view the food and food details on this functions, the
food details will be describe as food name, food quantity, food price, food offer.
Order
User can view all the food and food details after they wish to get permission to ordering a food
via our android phone and check the order is confirmed or not confirmed.
5. SYSTEM DEVELOPMENT
System development is one of the main aspects in this project. This means program with the help
of that program of which the system works. System development is actually a coding which
would be accurately made from which we must complete accordingly and the program. Every
language has their own personal coding.
5.1 PROGRAM DEVELOPMENT
SOURCE CODE
ADMIN L;OGIN
package com.example.food_order;
import java.io.DataInputStream;
import java.math.BigInteger;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Random;
import android.os.AsyncTask;
import android.os.Bundle;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
Button loginbtn;
EditText useremail;
EditText password;
TextView ttl;
public static String uemail="";
TextView register;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.user_login);
loginbtn = (Button) findViewById(R.id.button1);
register = (TextView)findViewById(R.id.textView2);
ttl = (TextView)findViewById(R.id.textView1);
useremail = (EditText)findViewById(R.id.u_name);
password = (EditText)findViewById(R.id.pass);
useremail.setHint("User Name");
//useremail.setText("admin");
//password.setText("admin");
ttl.setText("Admin Login");
register.setVisibility(View.INVISIBLE);
loginbtn.setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View arg0) {
// new userlogin().execute();
String lname=useremail.getText().toString();
String lpass=password.getText().toString();
if(lname.equals("admin")&&(lpass.equals("admin"))){
// register.setOnClickListener(new OnClickListener()
// {
//
// @Override
// public void onClick(View arg0) {
//
// Intent i = new
Intent(admin_login.this,user_reg.class);
//
//
// startActivity(i);
//
//
// }
// });
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is
present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
package com.example.food_order;
import java.io.DataInputStream;
import java.math.BigInteger;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.util.Random;
import android.os.AsyncTask;
import android.os.Bundle;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
new_food.setOnClickListener(new OnClickListener()
{
public void onClick(View arg0) {
Intent in = new Intent(getApplicationContext(), admin_new_food.class);
startActivity(in);
}
});
new_order.setOnClickListener(new OnClickListener()
{
public void onClick(View arg0) {
Intent in = new Intent(getApplicationContext(),
admin_new_order.class);
startActivity(in);
}
});
delivery.setOnClickListener(new OnClickListener()
{
public void onClick(View arg0) {
Intent in = new Intent(getApplicationContext(), admin_delivery.class);
startActivity(in);
}
});
logout.setOnClickListener(new OnClickListener()
{
public void onClick(View arg0) {
finish();
}
});
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is
present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}
package com.example.food_order;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import android.view.Gravity;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is
present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
public void commonRequestThread() {
status = "Please try again later";
pd.show();
final Handler handler = new Handler() {
public void handleMessage(Message msg) {
Runnable runnable = new Runnable() {
public void run() {
pd.dismiss();
if(user_id.size()<1){
if(isError) {
toast("No result found");
//finish();
}else{
toast("No data found");
}
//finish();
}else{
adapter = new ArrayAdapter<String>(context,
android.R.layout.simple_list_item_1,
android.R.id.text1, values);
listView.setAdapter(adapter);
}
}
};
try {
runOnUiThread(runnable);
} catch (Exception e) {
// TODO: handle exception
}
}
};
Thread checkUpdate = new Thread() {
public void run() {
try {
commonRequest();
} catch (Exception e) {
System.out.println("Error in fetching json : "
+ e.toString());
}
handler.sendEmptyMessage(0);
}
};
checkUpdate.start();
}
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(
is, "iso-8859-1"), 8);
StringBuilder sb = new StringBuilder();
String line = null;
while ((line = reader.readLine()) != null) {
sb.append(line + "n");
}
is.close();
result = sb.toString();
} catch (Exception e) {
System.out.println("Error 2 : "+e.toString());
}
System.out.println("result : "+result);
res = result;
JSONObject food_object;
try {
//food_object = new JSONObject(result);
if(result.contains("result")){
isError = false;
}
food_object = new JSONObject(result.substring(result.indexOf("{"),
result.lastIndexOf("}") + 1));
JSONArray foo_array = food_object.getJSONArray("result");
user_id.add(js.getString("id"));
String user=js.getString("user");
String food=js.getString("food");
String d2=js.getString("total");
//String sts=js.getString("quantity");
String status=js.getString("quantity");
values[i] = d;
categories.add(d);
// categories1.add(js.getString("tname"));
// System.out.println("value q : "+values[i]);
} catch (JSONException e) {
// TODO Auto-generated catch block
System.out.println("Error 3 : "+e.toString());
e.printStackTrace();
}
}
ArrayAdapter<String> adapter;
String values[];
Toast toast;
public void toast(String str) {
try {
toast.cancel();
} catch (Exception e) {
// TODO: handle exception
}
toast = Toast.makeText(this, str, Toast.LENGTH_SHORT);
toast.setGravity(Gravity.BOTTOM, 0, 0);
toast.show();
}
ADD FOOD
package com.example.food_order;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import android.view.Gravity;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is
present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
public void commonRequestThread() {
status = "Please try again later";
pd.show();
final Handler handler = new Handler() {
public void handleMessage(Message msg) {
Runnable runnable = new Runnable() {
public void run() {
pd.dismiss();
if(user_id.size()<1){
if(isError) {
toast("No result found");
//finish();
}else{
toast("No data found");
}
//finish();
}else{
adapter = new ArrayAdapter<String>(context,
android.R.layout.simple_list_item_1,
android.R.id.text1, values);
listView.setAdapter(adapter);
}
}
};
try {
runOnUiThread(runnable);
} catch (Exception e) {
// TODO: handle exception
}
}
};
Thread checkUpdate = new Thread() {
public void run() {
try {
commonRequest();
} catch (Exception e) {
System.out.println("Error in fetching json : "
+ e.toString());
}
handler.sendEmptyMessage(0);
}
};
checkUpdate.start();
}
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(
is, "iso-8859-1"), 8);
StringBuilder sb = new StringBuilder();
String line = null;
while ((line = reader.readLine()) != null) {
sb.append(line + "n");
}
is.close();
result = sb.toString();
} catch (Exception e) {
System.out.println("Error 2 : "+e.toString());
}
System.out.println("result : "+result);
res = result;
JSONObject food_object;
try {
//food_object = new JSONObject(result);
if(result.contains("result")){
isError = false;
}
food_object = new JSONObject(result.substring(result.indexOf("{"),
result.lastIndexOf("}") + 1));
JSONArray foo_array = food_object.getJSONArray("result");
values = new String[foo_array.length()];
for (int i = 0; i < foo_array.length(); i++) {
JSONObject js = foo_array.getJSONObject(i);
user_id.add(js.getString("id"));
String user=js.getString("user");
String food=js.getString("food");
String d2=js.getString("total");
//String sts=js.getString("quantity");
String status=js.getString("quantity");
values[i] = d;
categories.add(d);
// categories1.add(js.getString("tname"));
// System.out.println("value q : "+values[i]);
} catch (JSONException e) {
// TODO Auto-generated catch block
System.out.println("Error 3 : "+e.toString());
e.printStackTrace();
}
}
ArrayAdapter<String> adapter;
String values[];
Toast toast;
public void toast(String str) {
try {
toast.cancel();
} catch (Exception e) {
// TODO: handle exception
}
toast = Toast.makeText(this, str, Toast.LENGTH_SHORT);
toast.setGravity(Gravity.BOTTOM, 0, 0);
toast.show();
}
VIEW ORDERS
package com.example.food_order;
import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import com.example.food_order.user_login.userlogin;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import android.view.Gravity;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
pd.show();
final Handler handler = new Handler() {
public void handleMessage(Message msg) {
Runnable runnable = new Runnable() {
public void run() {
pd.dismiss();
if(user_id.size()<1){
if(isError) {
toast("No result found");
//finish();
}else{
toast("No data found");
}
//finish();
}else{
adapter = new ArrayAdapter<String>(context,
android.R.layout.simple_list_item_1,
android.R.id.text1, values);
listView.setAdapter(adapter);
}
}
};
try {
runOnUiThread(runnable);
} catch (Exception e) {
// TODO: handle exception
}
}
};
Thread checkUpdate = new Thread() {
public void run() {
try {
commonRequest();
} catch (Exception e) {
System.out.println("Error in fetching json : "
+ e.toString());
}
handler.sendEmptyMessage(0);
}
};
checkUpdate.start();
}
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(
is, "iso-8859-1"), 8);
StringBuilder sb = new StringBuilder();
String line = null;
while ((line = reader.readLine()) != null) {
sb.append(line + "n");
}
is.close();
result = sb.toString();
} catch (Exception e) {
System.out.println("Error 2 : "+e.toString());
}
System.out.println("result : "+result);
res = result;
JSONObject food_object;
// TextView txtFirstName = (TextView)
rootView.findViewById(R.id.txtFirstName);
// txtFirstName.setText(""+res);
try {
//food_object = new JSONObject(result);
if(result.contains("result")){
isError = false;
}
food_object = new JSONObject(result.substring(result.indexOf("{"),
result.lastIndexOf("}") + 1));
JSONArray foo_array = food_object.getJSONArray("result");
user_id.add(js.getString("id"));
String user=js.getString("user");
String food=js.getString("food");
String d2=js.getString("total");
//String sts=js.getString("quantity");
String status=js.getString("quantity");
String d=js.getString("id")+"-"+user+"\n"+food+"(Rs."+d2+")"+" No :
"+status;
values[i] = d;
categories.add(d);
// categories1.add(js.getString("tname"));
// System.out.println("value q : "+values[i]);
} catch (JSONException e) {
// TODO Auto-generated catch block
System.out.println("Error 3 : "+e.toString());
e.printStackTrace();
}
}
ArrayAdapter<String> adapter;
String values[];
Toast toast;
public void toast(String str) {
try {
toast.cancel();
} catch (Exception e) {
// TODO: handle exception
}
toast = Toast.makeText(this, str, Toast.LENGTH_SHORT);
toast.setGravity(Gravity.BOTTOM, 0, 0);
toast.show();
}
public class userlogin extends AsyncTask<String, String, String> {
@Override
protected void onPreExecute() {
super.onPreExecute();
pDialog = new ProgressDialog(admin_new_order.this);
pDialog.setMessage("Requesting...");
pDialog.setIndeterminate(false);
pDialog.setCancelable(true);
pDialog.show();
}
try {
} catch (Exception e) {
Log.i("Login Ex", e.getMessage());
}
return txt;
}
protected void onPostExecute(String file_url) {
Log.i("file_url", file_url);
if (file_url.trim().equals("success")) {
Toast.makeText(getApplicationContext(), "Success",
Toast.LENGTH_LONG).show();
finish();
}
else if(file_url.trim().equals("failed")) {
Toast.makeText(getApplicationContext(), "Failed",
Toast.LENGTH_LONG).show();
}
else
{ Toast.makeText(getApplicationContext(), "Please Check Login...!",
Toast.LENGTH_LONG).show();}
pDialog.dismiss();
}
}
}
USER REGISTER
package com.example.food_order;
import java.io.DataInputStream;
import java.math.BigInteger;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.util.Random;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
setContentView(R.layout.user_register);
regbtn = (Button) findViewById(R.id.reg);
name = (EditText)findViewById(R.id.name);
contact = (EditText)findViewById(R.id.con);
email = (EditText)findViewById(R.id.email);
pass1 = (EditText)findViewById(R.id.pass);
pass2 = (EditText)findViewById(R.id.cpass);
address = (EditText)findViewById(R.id.addr);
regbtn.setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View arg0) {
nam=name.getText().toString();
fpass=pass1.getText().toString();
spass=pass2.getText().toString();
cont=contact.getText().toString();
eml=email.getText().toString();
if(nam=="")
{
Toast.makeText(getApplicationContext(), "Enter all fileds",
Toast.LENGTH_LONG).show();
}
else if(fpass=="")
{
Toast.makeText(getApplicationContext(), "Enter all fileds",
Toast.LENGTH_LONG).show();
}
else if(spass=="")
{
Toast.makeText(getApplicationContext(), "Enter all fileds",
Toast.LENGTH_LONG).show();
}
else if(cont=="")
{
Toast.makeText(getApplicationContext(), "Enter all fileds",
Toast.LENGTH_LONG).show();
}
else if(eml=="")
{
Toast.makeText(getApplicationContext(), "Enter all fileds",
Toast.LENGTH_LONG).show();
}
else if(fpass.equals(spass))
{
// Toast.makeText(getApplicationContext(), "click",
Toast.LENGTH_LONG).show();
Log.i("Pass", "same");
new reg().execute();
}
else
{
Toast.makeText(getApplicationContext(), "failed",
Toast.LENGTH_LONG).show();
Intent i = new Intent(user_reg.this,user_reg.class);
startActivity(i);
}
//Toast.makeText(getApplicationContext(), "Success",
Toast.LENGTH_LONG).show();
}
});
}
public class reg extends AsyncTask<String, String, String> {
// String accno,name1,address,gen,pass,dob;
// String userid=u.getText().toString();
// String password=p.getText().toString();
String rnam=name.getText().toString();
String rfpass=pass1.getText().toString();
String rspass=pass2.getText().toString();
String rcont=contact.getText().toString();
String reml=email.getText().toString();
String address1=address.getText().toString();
@Override
protected void onPreExecute() {
// Toast.makeText(getApplicationContext(), "process",
Toast.LENGTH_LONG).show();
super.onPreExecute();
pDialog = new ProgressDialog(user_reg.this);
pDialog.setMessage("Requesting " + rnam + ")...");
pDialog.setIndeterminate(false);
pDialog.setCancelable(true);
pDialog.show();
}
protected String doInBackground(String... args) {
try {
String ur = "http://"+server_ipaddress.sip+"/user_register.php?"
+ "name=" +URLEncoder.encode(rnam, "UTF-8")
+ "&pass=" +URLEncoder.encode(rfpass, "UTF-8")
+ "&cont=" +URLEncoder.encode(rcont, "UTF-8")
+ "&email=" +URLEncoder.encode(reml, "UTF-8")
+"&address="+URLEncoder.encode(address1, "UTF-8") ;
Log.i("URL", ur);
URL url = new URL(ur);
HttpURLConnection uc = (HttpURLConnection) url.openConnection();
DataInputStream dis = new DataInputStream(uc.getInputStream());
String t = "";
while ((t = dis.readLine()) != null) {
txt += t;
}
//Log.i("Read", txt);
// m=txt;
dis.close();
} catch (Exception e) {
Log.i("Login Ex", e.getMessage());
}
return txt;
}
protected void onPostExecute(String file_url) {
Log.i("file_url", file_url);
String tmp=file_url;
if (file_url.trim().equals("success")) {
Toast.makeText(getApplicationContext(), "Success",
Toast.LENGTH_LONG).show();
finish();
// Intent in = new Intent(getApplicationContext(), login.class);
// startActivity(in);
}
// muser =uid.getText().toString();
pDialog.dismiss();
}
USER LOGIN
package com.example.food_order;
import java.io.DataInputStream;
import java.math.BigInteger;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Random;
import android.os.AsyncTask;
import android.os.Bundle;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
Button loginbtn;
EditText useremail;
EditText password;
TextView register;
public static String uemail="";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.user_login);
loginbtn = (Button) findViewById(R.id.button1);
register = (TextView)findViewById(R.id.textView2);
useremail = (EditText)findViewById(R.id.u_name);
password = (EditText)findViewById(R.id.pass);
//useremail.setText("arun@gmail.com");
//password.setText("123");
loginbtn.setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View arg0) {
new userlogin().execute();
}
});
register.setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View arg0) {
startActivity(i);
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is
present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
public class userlogin extends AsyncTask<String, String, String> {
String lname=useremail.getText().toString();
String lpass=password.getText().toString();
@Override
protected void onPreExecute() {
super.onPreExecute();
pDialog = new ProgressDialog(user_login.this);
pDialog.setMessage("Requesting " + lname + ")...");
pDialog.setIndeterminate(false);
pDialog.setCancelable(true);
pDialog.show();
}
try {
String ur = "http://"+server_ipaddress.sip+"/user_login.php?"+ "mail="
+ lname + "&pass=" +lpass;
} catch (Exception e) {
Log.i("Login Ex", e.getMessage());
}
return txt;
}
protected void onPostExecute(String file_url) {
Log.i("file_url", file_url);
if (file_url.trim().equals("success")) {
uemail=lname;
pDialog.dismiss();
}
package com.example.food_order;
import java.io.DataInputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import android.os.AsyncTask;
import android.os.Bundle;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
btn.setOnClickListener(new OnClickListener()
{
public void onClick(View arg0) {
String card1=card.getText().toString().trim();
String holder1=holder.getText().toString().trim();
String cvv1=cvv.getText().toString().trim();
String ex_date1=ex_date.getText().toString().trim();
if(card1.equals(""))
{
Toast.makeText(getApplicationContext(), "Enter Card Number",
Toast.LENGTH_LONG).show();
}
else if(holder1.equals(""))
{
Toast.makeText(getApplicationContext(), "Enter Holder Name",
Toast.LENGTH_LONG).show();
}
else if(cvv1.equals(""))
{
Toast.makeText(getApplicationContext(), "Enter cvv",
Toast.LENGTH_LONG).show();
}
else if(ex_date1.equals(""))
{
Toast.makeText(getApplicationContext(), "Enter ex_date",
Toast.LENGTH_LONG).show();
}
else
{
new userlogin().execute();
}
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is
present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
public class userlogin extends AsyncTask<String, String, String> {
String user=user_login.uemail;
String food_id=user_search_food.id;
String price=amount.getText().toString().trim();
String quntity=user_search_food_1.quantity;
String amoun2=amount.getText().toString().trim();
String card1=card.getText().toString().trim();
String holder1=holder.getText().toString().trim();
String cvv1=cvv.getText().toString().trim();
String ex_date1=ex_date.getText().toString().trim();
@Override
protected void onPreExecute() {
super.onPreExecute();
pDialog = new ProgressDialog(user_search_food_2.this);
pDialog.setMessage("Requesting...");
pDialog.setIndeterminate(false);
pDialog.setCancelable(true);
pDialog.show();
}
protected String doInBackground(String... args) {
String txt = "";
try {
String ur = "http://"+server_ipaddress.sip+"/user_payment.php?"
+ "user=" + URLEncoder.encode(user, "UTF-8")
+ "&food=" +URLEncoder.encode(user_search_food_1.food_name, "UTF-8")
+ "&quantity=" +URLEncoder.encode(quntity, "UTF-8")
+ "&price=" +URLEncoder.encode(price, "UTF-8")
} catch (Exception e) {
Log.i("Login Ex", e.getMessage());
}
return txt;
}
protected void onPostExecute(String file_url) {
Log.i("file_url", file_url);
if (file_url.trim().equals("success")) {
Toast.makeText(getApplicationContext(), "Success",
Toast.LENGTH_LONG).show();
finish();
}
else if(file_url.trim().equals("failed")) {
Toast.makeText(getApplicationContext(), "Failed",
Toast.LENGTH_LONG).show();
}
else
{ Toast.makeText(getApplicationContext(), "Please Check Login...!",
Toast.LENGTH_LONG).show();}
pDialog.dismiss();
}
package com.example.food_order;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import android.view.Gravity;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.user_search_food_1);
btn.setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View arg0) {
quantity=qty.getText().toString().trim();
if(quantity.isEmpty())
{
Toast.makeText(getApplicationContext(), "Enter quantity",
Toast.LENGTH_LONG).show();
}
else
{
food_price=price.getText().toString().trim();
food_discount=discount.getText().toString().trim();
food_gst=gst.getText().toString().trim();
food_name=food.getText().toString().trim();
Intent i = new
Intent(user_search_food_1.this,user_search_food_2.class);
startActivity(i);
finish();
}
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is
present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
public void commonRequestThread() {
status = "Please try again later";
pd.show();
final Handler handler = new Handler() {
public void handleMessage(Message msg) {
Runnable runnable = new Runnable() {
public void run() {
pd.dismiss();
if(user_id.size()<1){
if(isError) {
toast("No result found");
// finish();
}else{
toast("No data found");
}
// finish();
}else{
adapter = new ArrayAdapter<String>(context,
android.R.layout.simple_list_item_1,
android.R.id.text1, values);
listView.setAdapter(adapter);
}
}
};
try {
runOnUiThread(runnable);
} catch (Exception e) {
// TODO: handle exception
}
}
};
Thread checkUpdate = new Thread() {
public void run() {
try {
commonRequest();
} catch (Exception e) {
System.out.println("Error in fetching json : "
+ e.toString());
}
handler.sendEmptyMessage(0);
}
};
checkUpdate.start();
}
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(
is, "iso-8859-1"), 8);
StringBuilder sb = new StringBuilder();
String line = null;
while ((line = reader.readLine()) != null) {
sb.append(line + "n");
}
is.close();
result = sb.toString();
} catch (Exception e) {
System.out.println("Error 2 : "+e.toString());
}
System.out.println("result : "+result);
res = result;
JSONObject food_object;
try {
//food_object = new JSONObject(result);
if(result.contains("result")){
isError = false;
}
food_object = new JSONObject(result.substring(result.indexOf("{"),
result.lastIndexOf("}") + 1));
JSONArray foo_array = food_object.getJSONArray("result");
user_id.add(js.getString("id"));
food.setText(js.getString("food_name"));
category.setText(js.getString("category"));
price.setText(js.getString("price"));
gst.setText(js.getString("gst"));
discount.setText(js.getString("discount"));
String uprof=js.getString("file_name");
String image_url = "http://"+server_ipaddress.sip+"/uploads/"+uprof;
// String d=js.getString("id")+"-"+js.getString("food");
// categories1.add(js.getString("id"));
// System.out.println("value q : "+values[i]);
} catch (JSONException e) {
// TODO Auto-generated catch block
System.out.println("Error 3 : "+e.toString());
e.printStackTrace();
}
}
ArrayAdapter<String> adapter;
String values[];
Toast toast;
public void toast(String str) {
try {
toast.cancel();
} catch (Exception e) {
// TODO: handle exception
}
toast = Toast.makeText(this, str, Toast.LENGTH_SHORT);
toast.setGravity(Gravity.BOTTOM, 0, 0);
toast.show();
}
}
package com.example.food_order;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import android.view.Gravity;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
if(t.equals(""))
{
Toast.makeText(getApplicationContext(), "Enter Values",
Toast.LENGTH_LONG).show();
}
else
{
text=t;
commonRequestThread();
}
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is
present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
public void commonRequestThread() {
status = "Please try again later";
pd.show();
final Handler handler = new Handler() {
public void handleMessage(Message msg) {
Runnable runnable = new Runnable() {
public void run() {
pd.dismiss();
if(user_id.size()<1){
if(isError) {
toast("No result found");
// finish();
}else{
toast("No data found");
}
// finish();
}else{
adapter = new ArrayAdapter<String>(context,
android.R.layout.simple_list_item_1,
android.R.id.text1, values);
listView.setAdapter(adapter);
}
}
};
try {
runOnUiThread(runnable);
} catch (Exception e) {
// TODO: handle exception
}
}
};
Thread checkUpdate = new Thread() {
public void run() {
try {
commonRequest();
} catch (Exception e) {
System.out.println("Error in fetching json : "
+ e.toString());
}
handler.sendEmptyMessage(0);
}
};
checkUpdate.start();
}
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(
is, "iso-8859-1"), 8);
StringBuilder sb = new StringBuilder();
String line = null;
while ((line = reader.readLine()) != null) {
sb.append(line + "n");
}
is.close();
result = sb.toString();
} catch (Exception e) {
System.out.println("Error 2 : "+e.toString());
}
System.out.println("result : "+result);
res = result;
JSONObject food_object;
try {
//food_object = new JSONObject(result);
if(result.contains("result")){
isError = false;
}
food_object = new JSONObject(result.substring(result.indexOf("{"),
result.lastIndexOf("}") + 1));
JSONArray foo_array = food_object.getJSONArray("result");
user_id.add(js.getString("id"));
String d=js.getString("id")+"-"+js.getString("food_name");
qry_list[i]=js.getString("id");
values[i] = d;
categories.add(d);
// categories1.add(js.getString("tname"));
// System.out.println("value q : "+values[i]);
} catch (JSONException e) {
// TODO Auto-generated catch block
System.out.println("Error 3 : "+e.toString());
e.printStackTrace();
}
}
Toast toast;
public void toast(String str) {
try {
toast.cancel();
} catch (Exception e) {
// TODO: handle exception
}
toast = Toast.makeText(this, str, Toast.LENGTH_SHORT);
toast.setGravity(Gravity.BOTTOM, 0, 0);
toast.show();
}
}
<?php
include("dbconnect.php");
extract($_POST);
$email=$_REQUEST['email'];
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
else
{
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
array_push($resvalues,array("id"=>$row['id'],"food"=>$row['food'],"qua
ntity"=>$row['quantity'],"price"=>$row['price'],"total"=>$row['total']
,"status"=>$row['status']));
}
}
echo json_encode(array("result"=>$resvalues));
$conn->close();
?>
5. SYSTEM TESTING
A Project system must be thoroughly tested to reveal its errors and misconceived before it is
finally delivered to the user who bought it. Planning the testing of a programming system
involves formulating a set of sets of test cases, problems and important points. Which are similar
to the real data that the system is intended to manipulate?
Validation testing begins with the help of spiral and concentrates on each unit of the limitation of
the software as implemented in the source code. Initially test focus on each individually, assuring
it the functions properly as a unit. Hence the name is Validation testing. Validation testing makes
heavy usage of limiting techniques, exercising the specific path of the required desire of
choosing and in a module’s control structure to ensure complete coverage the maximum data
detection.
6. SYSTEM IMPLEMENTATION
7. CONCLUSION
Our project is only a humble venture to satisfy the needs to manage their project work. Several
user friendly coding have also adopted. This package shall prove to be a powerful package in
satisfying all the requirements of the school. The objective of software planning is to provide a
frame work that enables the manager to make reasonable estimates made within a limited time
frame at the beginning of the software project and should be updated regularly as the project
progresses
FUTURE WORK
We can give more advanced software for online food ordering system including more
facilities.
We will host the platform on online services to make it accessible worldwide.
Create a master and slave database structure to reduces the overload of the database on
regular basis on different servers.
BIBLIOGRAPHY
BOOK REFERENCES
[1] Programming Android Java Programming for the New Generation of Mobile Devices” by
Zigurd Mennieks
[3] “Learning Android Building Applications for the Android Market” by Marko Gargenta
[4] “Android Programming: The Big Nerd Ranch Guide” by Bill Phillips and Chris Stewart
[5] “Head First Android Development: A Brain-Friendly Guide” by Dawn Griffiths and David
Griffiths
WEB REFERENCES
[1] https://www.researchgate.net/publication/263027693_Mobile_Food_Ordering_Application_/
[2] https://sites.google.com/site/ignoubcafinalyearprojects/project-report/food-ordering-project-
report
[3] https://www.filemakr.com/btech-final-year-project-report-online-food-ordering