You are on page 1of 68

CHAPTER 1

INTRODUCTION

The prevalence of Web and Online To Offline (O2O) marketing model has
led to the boom of various online event-based social networks (EBSNs). For
example, Groupon1 collects group purchase events and recommends these group
discounts to users, and Meet up receives information on recruitment of attendees in
offline events, such as gatherings, sports activities, etc., and sends such information
to users. Such EBSNs facilitate organizing social events and ease the recruitment
of group activity participants.
Recent location-based online social networking services,such as Foursquare
(foursquare.com) and Gowalla (gowalla.com), represent another type of popular
social network, called a location-based social network (LBSN). They are somewhat
similar to EBSNs, as they capture online social interactions as well as offline
location checkins. However, unlike the offline social events that incur a group of
people with social interactions, location checkins from LBSNs mostly represent
individual behaviors, i.e. a particular user was at a specific location at a specific
time. Although adjacent checkins were treated as one kind of reason for social
network tie creation. It is estimated that adjacent checkins have only a 24% chance
to lead to a new social friendship in Gowalla.

Like conventional online social networks, EBSNs provide an online virtual


world where users exchange thoughts and share experiences. But what
distinguishes EBSNs from conventional social networks is that EBSNs also
capture the face-to-face social interactions in participating events in the offline
physical world.
Community structure detection is a very useful approach for analyzing social
networks. However, to correctly detect communities in an EBSN, one has to
consider both online and offline social interactions.
Meet up is an online social event service that helps people publish and
participate in social events. On Meet up, a social event is created by a user by
specifying when, where and what the event is. Then, the created social event is
made available to selected users or public, controlled by the event creators. Other
users may express their intent to join the event by RSVP (\yes", \no" or \maybe")
online. To facilitate online interactions, meetup.com also allows users to form
social groups (e.g. \bay area single moms", \Nevada county walkers") to share
comments, photos and event plans.
Existing EBSNs only provide an information sharing platform without
strategic event organization and personalized event planning. Recently, the
problem of global event organization strategy in EBSNs has been brought to
attention. proposes the Social Event Organization (SEO)problem to assign events
to users, which maximizes the overall satisfaction of users towards the arranged
events and also the social affinity among the users participating the same event.
However, this work only considers a simple case of assigning one single event to
each participant and thus naturally ignores both spatiotemporal conflicts of
different events and multiple events planning for each participant.
Fundamental task of managing EBSN platforms is to recommend suitable
social events to potential users according to the following three factors: distances
between events and users, attribute similarities between events and users and friend
relationships among users. However, none of existing approaches consider all
aforementioned influential factors when they recommend users to proper events.
Furthermore, existing recommendation strategies neglect the bottleneck cases on
the global recommendation. Thus, it is impossible for the existing recommendation
solutions to achieve the optimal utility in real world scenarios.
However the existing social network recommendation systems usually adopt
recommendation strategies for each single activity instead of providing globally
optimal arrangements. Since each user only attends one activity at the same time, it
easily leads that some activities only attract a few attendances but participants in
other activities are excess. Therefore, in order to satisfy all registered activities in
EBSN, a reasonable global goal is to find the optimized arrangement that
maximizes the minimum average total utility of activities.
Infrastructure as a service (IaaS)

According to the Internet Engineering Task Force (IETF), the most basic cloud-
service model is that of providers offering computing infrastructure virtual
machines and other resources as a service to subscribers. Infrastructure as a
service (IaaS) refers to online services that abstract the user from the details of
infrastructure like physical computing resources, location, data partitioning,
scaling, security, backup etc. A hypervisor, such as Xen, Oracle VirtualBox, Oracle
VM, KVM, VMware ESX/ESXi, or Hyper-V, runs the virtual machines as guests.
Pools of hypervisors within the cloud operational system can support large
numbers of virtual machines and the ability to scale services up and down
according to customers' varying requirements. Linux containers run in isolated
partitions of a single Linux kernel running directly on the physical hardware.
Linuxc groups and namespaces are the underlying Linux kernel technologies used
to isolate, secure and manage the containers. Containerisation offers higher
performance than virtualization, because there is no hypervisor overhead. Also,
container capacity auto-scales dynamically with computing load, which eliminates
the problem of over-provisioning and enables usage-based billing.IaaS clouds often
offer additional resources such as a virtual-machine disk-image library, raw block
storage, file or object storage, firewalls, load balancers, IP addresses, virtual local
area networks (VLANs), and software bundles.

IaaS-cloud providers supply these resources on-demand from their large pools
of equipment installed in data centers. For wide-area connectivity, customers can
use either the Internet or carrier clouds (dedicated virtual private networks). To
deploy their applications, cloud users install operating-system images and their
application software on the cloud infrastructure. In this model, the cloud user
patches and maintains the operating systems and the application software. Cloud
providers typically bill IaaS services on a utility computing basis: cost reflects the
amount of resources allocated and consumed

Platform as a service (PaaS)

PaaS vendors offer a development environment to application developers. The


provider typically develops toolkit and standards for development and channels for
distribution and payment. In the PaaS models, cloud providers deliver a computing
platform, typically including operating system, programming-language execution
environment, database, and web server. Application developers can develop and
run their software solutions on a cloud platform without the cost and complexity of
buying and managing the underlying hardware and software layers. With some
PaaS offers like Microsoft Azure and Google App Engine, the underlying computer
and storage resources scale automatically to match application demand so that the
cloud user does not have to allocate resources manually. The latter has also been
proposed by an architecture aiming to facilitate real-time in cloud
environments. Even more specific application types can be provided via PaaS, such
as media encoding as provided by services like bitcodin.com or media.io.
Software as a service (SaaS)

In the software as a service (SaaS) model, users gain access to application software
and databases. Cloud providers manage the infrastructure and platforms that run
the applications. SaaS is sometimes referred to as "on-demand software" and is
usually priced on a pay-per-use basis or using a subscription fees. In the SaaS
model, cloud providers install and operate application software in the cloud and
cloud users access the software from cloud clients. Cloud users do not manage the
cloud infrastructure and platform where the application runs. This eliminates the
need to install and run the application on the cloud user's own computers, which
simplifies maintenance and support. Cloud applications differ from other
applications in their scalabilitywhich can be achieved by cloning tasks onto
multiple virtual machines at run-time to meet changing work demand.Load
balancers distribute the work over the set of virtual machines. This process is
transparent to the cloud user, who sees only a single access-point. To accommodate
a large number of cloud users, cloud applications can be multitenant, meaning that
any machine may serve more than one cloud-user organization.

Mobile "backend" as a service (MBaaS)

In the mobile "backend" as a service (m) model, also known as backend as a


service (BaaS), web app and mobile app developers are provided with a way to
link their applications to cloud storage and cloud computing services
with application programming interfaces (APIs) exposed to their applications and
custom software development kits(SDKs). Services include user
management, push notifications, integration with social networking services and
more. This is a relatively recent model in cloud computing with most
BaaS startups dating from 2011 or later but trends indicate that these services are
gaining significant mainstream traction with enterprise consumers.

Most existing EBSNs only provide a public/open event information sharing


platform , where strategic organization and global event-participant arrangement
are absent. Many users confront with a confusing choice from many conflicting
events. Besides resolving conflicts of events, it is appealing to have an event-
participant arrangement strategy that globally optimizes the benefits of both event
organizers and users, e.g. for organizing a carnival or a film festival.
Event-based social networks (EBSNs) are getting popular because of the
rapid development of Web 2.0 and Online To Offline (O2O) marketing model. An
important task of EBSNs is to facilitate the most satisfactory event-participant
arrangement for both sides, i.e. events enroll more participants and participants are
arranged with personally interesting events.Existing approaches usually focus on
the arrangement of each single event to a set of potential users, or ignore the
conflicts between different events, which leads to infeasible or redundant
arrangements.A more general and useful event-participant arrangement problem,
called Global Event-participant Arrangement with Conflict and Capacity (GEACC)
problem, focusing on the conflicts of different events and making event-participant
arrangements in a global view is identified.
CHAPTER 2

LITERATURE SURVEY

2.1 LITERATURE REVIEW

Jieying She, Yongxin Tong, Lei Chen, Caleb Chen Cao ,Conflict-Aware
Event-Participant Arrangement,IEEE 31st International Conference on Data
Engineering,pp.735-746,2015
With the rapid development of Web 2.0 and Online To Offline (O2O) marketing
model, various online event-based social networks (EBSNs), such as Meet up and
Whoa, are getting popular. An important task of EBSNs is to facilitate the most
satisfactory event-participant arrangement for both sides, i.e. events enroll more
participants and participants are arranged with personally interesting events.
Existing approaches usually focus on the arrangement of each single event to a set
of potential users, and ignore the conflicts between different events, which leads to
infeasible or redundant arrangements.To address the shortcomings of existing
approaches, a more general and useful event-participant arrangement problem,
called Global Event-participant Arrangement with Conflict and Capacity (GEACC)
problem is identified focusing on the conflicts of different events and making
event-participant arrangements in a global view. Though it is useful, unfortunately,
its found that the GEACC problem is NP-hard due to the conflict constraints
among events. Thus two approximation algorithms with provable approximation
ratios and an exact algorithm with pruning technique to address this problem are
defined. Finally the effectiveness and efficiency of the proposed methods through
extensive experiments on real and synthetic datasets is verified.
Xingjie Liu, Qi Hey, Yuanyuan Tiany, Wang-Chien Lee, John McPhersony,
Event-based Social Networks: Linking the Online and Offline Social
Worlds,OCTOBER 2012
Newly emerged event-based online social services, such as Meet up and
Plan cast, have experienced increased popularity and rapid growth. From these
services, we observed a new type of social network { event-based social network}
(EBSN). An EBSN does not only contain online social interactions as in other
conventional online social networks, but also includes valuable offline social
interactions captured in offline activities. By analyzing real data collected from
Meet up, EBSN properties and discovered many unique and interesting
characteristics, such as heavy-tailed degree distributions and strong locality of
social interactions is investigated . Here the heterogeneous nature (co- existence
of both online and offline social interactions) of EBSNs on two challenging
problems: community detection and information overview are studied. Its found
that communities detected in EBSNs are more cohesive than those in other types of
social networks (e.g. location-based social networks). In the context of information
overview, the event recommendation problem is studied . By experimenting
various information discussion patterns, its found that a community-based
discussion model that takes into account of both online and offline interactions
provides the best prediction power. The research to study EBSNs at scale paves
the way for future studies on this new type of social network. A sample dataset of
this study can be down- loaded from http://www.largenetwork.org/ebsn.

Jieying Shey, Yongxin Tongz, Lei Cheny, Utility-Aware Social Event-


Participant Planning,JANUARY 2015
Online event-based social network (EBSN) platforms are becoming popular
these days. An important task of managing EBSNs is to arrange proper social
events to interested users. Existing approaches usually assume that each user only
at- tends one event or ignore location information. The overall utility of such
strategy is limited in real world:
1) each user may attend multiple events
2) attending multiple events will incur spatiotemporal conflicts and travel
expenses.
Thus, a more intelligent EBSN platform that provides personalized event planning
for each participant is desired. In this paper, we first formally define the problem of
Utility-aware Social Event-participant Planning (USEP), which is proven to be NP-
hard. To solve the USEP problem, we first devise a greedy-based heuristic
algorithm, which performs fast under certain circumstances but has no
approximation guarantee. Then a two-step approximation framework, which not
only guarantees a 1/2 -approximation ratio but also includes a series of
optimization techniques to improve its space/time efficiency is presented. Finally,
the efficiency and effectiveness of the proposed methods through extensive
experiments on real and synthetic datasets is verified.

Yongxin Tong , Rui Meng, Jieying She , On Bottleneck-Aware Arrangement


for Event-Based Social Networks, 31st IEEE Interanational Conference On
Data Engineering Workshops,pp.216-223,FEBRUARY 2015
With the popularity of mobile computing and social media, various kinds of
online event-based social network (EBSN) platforms, such as Meet up, Plan cast
and Whoa, is gaining in prominence. A fundamental task of managing EBSN
platforms is to recommend suitable social events to potential users according to the
following three factors: distances between events and users, attribute similarities
between events and users and friend relationships among users. However, none of
existing approaches consider all aforementioned influential factors when they
recommend users to proper events. Furthermore, existing recommendation
strategies neglect the bottleneck cases on the global recommendation. Thus, it is
impossible for the existing recommendation solutions to achieve the optimal utility
in real world scenarios.Here the problem of bottleneck-aware social event
arrangement (BSEA), which is proven to be NP-hard is defined. To solve the
BSEA problem approximately, we devise two greedy-based heuristic algorithms,
Greedy and Random+Greedy. In particular, the Random+Greedy algorithm is
faster and more effective than the Greedy algorithm in most cases. Finally, we
conduct extensive experiments on real and synthetic datasets which verify the
efficiency and accuracy of our proposed algorithms.

Leong Hou U, Man Lung, Yiu Kyriakos Mouratidis, Nikos Mamoulis


Capacity Constrained Assignment in Spatial Databases, JANUARY 2008
Given a point set P of customers (e.g., WiFi receivers) and a point set Q of
service providers (e.g., wireless access points), where each q 2 Q has a capacity
q.k, the capacity constrained assignment (CCA) is a matching M Q P such that
(i) each point q 2 Q (p 2 P) appears at most k times (at most once) in M, (ii) the
size of M is maximized (i.e., it comprises min{|P|, P q2Q q.k} pairs), and (iii) the
total assignment cost (i.e., the sum of Euclidean distances within all pairs) is
minimized. Thus, the CCA problem is to identify the assignment with the optimal
overall quality; intuitively, the quality of qs service to p in a given (q, p) pair is
anti-proportional to their distance. Although max-flow algorithms are applicable to
this problem, they require the complete distance-based bipartite graph between Q
and P. For large spatial datasets, this graph is expensive to compute and it may be
too large to fit in main memory. Motivated by this fact, efficient algorithms for
optimal assignment that employ novel edge-pruning strategies, based on the spatial
properties of the problem is proposed. Additionally, we develop approximate (i.e.,
suboptimal) CCA solutions that provide a trade-off between result accuracy and
computation cost, abiding by theoretical quality guarantees. A thorough
experimental evaluation demonstrates the efficiency and practicality of the
proposed techniques.

2.2 DRAWBACKS IN EXISTING SYSTEM:

Events Details are not shown to anyone.


Delay for event registration process.
Conjunction occur.
No portability.

2.3 SCOPE OF THE SYSTEM


Application for Event-based social networks (EBSNs) for Event-participant
arrangement is done.
This application facilitates the event participant arrangement in a manner that
avoid the conflicts that occur during the participation so that the users and admin
do not have any confusions regarding the events that are taking place. The storage
for event details can be changed according to the infrastructure basis to maintain
the level of performance. The application can be used to enable more users to
participate in the events in a global way. It helps to achieve a good level of
interaction between the admin as well as the users.

CHAPTER 3

SYSTEM DESIGN

3.1 PROBLEM DEFINITION


In the present the arrangement of events are taking place in a manual recording
manner. This leads to a lot of confusion in allocating the participants for the events.
This project helps us to identify a problem called GEACC(Global Event-
Paricipant Arrangement with Conflict and Capacity).It helps to overcome the
issues that occur during the manual recording of events. It allows the users to
participate in the events based on the users interest. The user can view the events
created by the admin on the particular date given as input and retrieve the results.
The user can register if he/she is interested and can see the list of events that are
conducted. Then the user can view the registration status.
This project enables more interaction between the user and admin which was not
available in the previous days. Here we enable an active participation between
the users and the admin.
3.2 SYSTEM ARCHITECTURE
Figure 3.1 System Architecture
The registration process starts from admin side. The admin logs in and
stores the event name, date, time , location, contact details in the database. Now
the user can register as well as login. If the user is a new user then he/she has to
enter the essential details and it will be saved in the database. If the user is already
an existing user they can login by giving the user no and password. Then the user
can give the request for the list of events on a particular date and the events will be
given as a response .If available on that date after admin checks the availability on
that date. Then the user can register for the events in which they are interested and
the admin sends the registration status to the user.

Register and Login


This is used for carrying out the registration process by the user. The admin as well
as the user can login and perform the interaction.
Hostinger cloud hosting
It is used to provide the cloud service to the users. It is used for storage purpose.
Event Creation
This is used by the admin for event creation to add event details such as event
name, date, time , location , contact details.
Events Catalogue
It is used to contain the list of events that were created by the admin.
Checks availability
The admin checks the list of events available in the database based on the date
given by the user as input. If the events are available on that date they will be
returned to the user as response.
3.3 REQUIREMENT SPECIFICATION

3.3.1 HARDWARE REQUIREMENTS

PROCESSOR : Intel Core i3.


RAM : 4 GB RAM
MONITOR : 15 COLOR
HARD DISK : 500 GB

3.3.2 SOFTWARE REQUIREMENTS

Front End : ANDROID XML, JAVA


Back End : SQLITE
Operating System : Windows 07
IDE : Eclipse, Android Studio
Cloud service provider : Hostinger
CHAPTER 4

SYSTEM IMPLEMENTATION

4.1 OVERVIEW OF THE MODULES


The main aim of the project is to facilitate the event-participant arrangement in a
global manner. The project consist of about five modules by which it satisfies
event-participant arrangement in a global manner. The input given by the user is a
particular date for the events. It is checked with the availability of events and the
results are given to the user as a response. The registration status will be given to
the user after they perform registration for the events. The modules are for various
actions such as registration and database creation, event creation, listing events,
user registration and registration status.
LIST OF MODULES
1.Registration and database creation
2.Event creation
3.Listing up the events
4.User registration for events
5.Registration status

4.2 DESCRIPTION OF THE MODULES


The login as well as registration can be done by the user. The admin stores the
event details in the database. The user can view the list of events by using the date.
The list of events are displayed and the user can perform registration for the events.
The registration status will be updated to the user based on the user request given.
OVERALL STEPS CARRIED OUT
The steps are
Step 1: Start
Step 2: If user wants to login they can be either an existing or a new user.
Step 3: If the user is a new user they need to enter user number, roll number,
password and it will be saved in a database.
Step 4: If the user is an existing user then they can login by giving user number and
password.
Step 5: The details will be matched with the database if they are valid the user can
view the next page.
Step 6: If the admin logs in they enter the event details such as event name, place,
date, time, contact details in the database.
Step 7: Now the user can search for the events by entering the date.
Step 8: The details of the events taking place will be displayed.
Step 9: Now the user can perform registration after viewing the events based on
their interest.
Step 10: The user needs to enter the details such as name, department, gender,
phone no, email id etc.
Step 11: After submission of details the user can view the events that they have
registered.
Step 12: The status will be given to the user after registration is done.

4.2.1 Registration and database creation


The login as well as registration can be performed by the user. If the user is a new
user then he/she needs to store their necessary details in a database and they can
perform login process. If the user is a existing one they need to enter the user
number and password and can login. The admin can login to the system by giving
the user number and password. User number and password have been stored after
registration. Android uses SQLite Database for storing and fetching user
application details.
Import the necessary packages to be used in the program. Perform login process
as the user needs to perform registration.
First create the java files with the necessary files to be imported. Declare the
essential variables that are to be used in the program. Using the functions execute
the program. If user wants to login they can be either an existing or a new user. If
the user is a new user they need to enter user number, roll number, password and it
will be saved in a database. If the user is an existing user then they can login by
giving user number and password. The length of the user number will be checked
if less than 10 digits shows a message to enter 10 digits. Similarly the length of
password also will be checked. The admin can login and enter the event details
such as event name, place, date, time, contact details which will be stored in the
database.

admin

Existing or new
user? Existing
user Login by entering
database
user no and password

New user

Enter details such as user


no, roll no ,password and
save in database

Figure 4.1 Registration and database creation

4.2.2 Event creation


The admin stores the event name, date, time, location, contact details in the
database. They can add any number of events and can view the events registered
by the users.
Import the necessary packages into the java files that are necessary for execution of
the program. Now login as admin so that the admin can enter the event details for
the users to register themselves for the events.
Create the java files with the necessary files to be imported. Declare the essential
variables that are to be used in the program. Using the functions execute the
program. Login as admin. Enter the event name , date , time, location ,contact
details. Press the add button to add in the database. To view the list of events that
have been registered by users use the next button present near the add button.

Event name
admin Date Additionof database
event details
Time
Location

Contact
Figure 4.2 Event creation
4.2.3 Listing up the events
This module is used to display the event details. Here the user gives the date as
input and the events on that date will be shown to the user as a response.
Receive the input from the user through the datepicker option which is used to list
the events that are available on the particular date given by the user as request to
the admin.
Create the java files with the necessary files to be imported. Declare the essential
variables that are to be used in the program. Using the functions execute the
program. Login as user. Select the date for the event to be shown using the
datepicker. Select the GetEvent button to see the list of events on that date. The
user can view the list of events and can register for the events. The user can change
their password if they need to do so.

If events are
available?
user Select yes Event 1
date Event2
using .
date
picker

no
No records
found

Figure 4.3 Listing up the events

4.2.4 User registration for events


This module is used for registration purpose. After viewing the events available on
that particular date the user can perform registration for the event and the user
request will be sent to the admin side for the particular event.
Create the java files with the necessary files to be imported. Declare the essential
variables that are to be used in the program. Using the functions execute the
program. User selects the event to participate. After the selection process, the page
containing the necessary fields to be filled by user is displayed. The user enters the
details such as department, name, gender , date of birth, address ,mail id, contact
no to be saved in the database. After clicking submit the details will be saved in
the database.
If any event
selected? Enter department,
Yes yes name, gender ,date of
user
birth, address ,mail id,
contact no to be saved
in the database.

no

exit

Figure 4.4 User Registration for events

4.2.5 Registration Status


This module is used by the admin to view all the event request from the user side.
Finally the admin decide whether to accept the user request or reject. If the user
request is to accept then the status will be updated to the user side.
Create the java files with the necessary files to be imported. Declare the essential
variables that are to be used in the program. Using the functions execute the
program. Login as admin. View the list of events that are requested by the users.
Select the event to provide registration status to the user. Then the admin decides
whether to accept, reject or back the user request.
Admin
admin View event
Decision yes Accept
requests
Event 1 request
Event 2
..
Reject
request
no
Figure 4.5 Registration Status

APPENDIX

Registration and database creation

Splash.java
package com.example.webdata;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
public class Splash extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
Thread background = new Thread() {
public void run() {
try {
// Thread will sleep for 5 seconds
sleep(4*1000);
// After 5 seconds redirect to another intent
Intent i=new Intent(getApplicationContext(),Login.class);
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
i.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
startActivity(i);
//Remove activity
finish();
}
catch (Exception e) {
}
}
};
// start thread
background.start();
}
}
Login.java
package com.example.webdata;
import java.io.IOException;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.util.EntityUtils;
import org.json.JSONException;
import org.json.JSONObject;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
public class Login extends Activity implements OnClickListener, OnItemSelectedListener
{
EditText e1,e2;
ImageButton b;
TextView t;
Spinner sp;
String spin;
SharedPreferences sh=null;
SharedPreferences.Editor edit;
String[] sname={"User","Admin"};
String number,pass;
public String rollno;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
sh=getSharedPreferences("share",Activity.MODE_APPEND);
edit=sh.edit();
e1=(EditText)findViewById(R.id.editText1);
e2=(EditText)findViewById(R.id.editText2);
b=(ImageButton)findViewById(R.id.button1);
sp=(Spinner)findViewById(R.id.spinner1);
t=(TextView)findViewById(R.id.textView2);
b.setOnClickListener(this);
t.setOnClickListener(this);
sp.setOnItemSelectedListener(this);
ArrayAdapter<String>aa=new
ArrayAdapter<String>(this,android.R.layout.simple_spinner_item,sname);
sp.setAdapter(aa);
}
@Override
public void onClick(View v)
{
// TODO Auto-generated method stub
number=e1.getText().toString().trim();
pass=e2.getText().toString().trim();
if(v==b)
{
if(number.equals("")||pass.equals(""))
{
Toast.makeText(getApplicationContext(), "Please enter the value",
Toast.LENGTH_SHORT).show();
}
else
{

// if(spin.equals("User"))
// {
// Intent i=new Intent(getApplicationContext(),Userhome.class);
// startActivity(i);
// }
// else
// {
// Intent i1=new Intent(getApplicationContext(),Adminhome.class);
// startActivity(i1);
// }
new LogIn(Login.this).execute();
e1.setText("");
e2.setText("");
}
}
if(v==t)
{
Intent i=new Intent(getApplicationContext(),Register.class);
startActivity(i);
}
}
private class LogIn extends AsyncTask<Void, Void, Void>
{
ProgressDialog pDialog;
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpEntity httpEntity = null;
HttpResponse httpResponse = null;
String response;
int wchecker;
public LogIn(Login mainActivity) {
// TODO Auto-generated constructor stub
}
@Override
protected void onPreExecute() {
super.onPreExecute();
// Showing progress dialog
pDialog = new ProgressDialog(Login.this);
pDialog.setMessage("Please wait...");
pDialog.setCancelable(false);
pDialog.show();
}
@Override
protected Void doInBackground(Void... arg0) {
// Creating service handler class instance
// ServiceHandler sh = new ServiceHandler();
String url="http://baladatabase.96.lt/Webdata/login.php?
name="+number+"&passwd="+pass;
Log.i("url", url);
HttpGet httpGet = new HttpGet(url);
try
{
httpResponse = httpClient.execute(httpGet);
httpEntity = httpResponse.getEntity();
response = EntityUtils.toString(httpEntity);

}
catch (IOException e1)
{
// TODO Auto-generated catch block
e1.printStackTrace();
}
// Making a request to url and getting response
//String jsonStr = sh.makeServiceCall(url, ServiceHandler.GET);
Log.d("Response: ", "> " + response);
if (response != null) {
try {
JSONObject jsonObj = new JSONObject(response);
String success=(jsonObj.getString("success"));
rollno=(jsonObj.getString("rollno"));
Log.d("Success: ", "> " + success);
if(success.matches("welcome"))
{
Log.d("Success: ", "Data inserted");
wchecker=1;
}
else
{
Log.d("Error: ", "Data not inserted");
wchecker=0;
}
}
catch (JSONException e)
{
e.printStackTrace();
}
}
else {
Log.e("ServiceHandler", "Couldn't get any data from the url");
}
return null;
}
@Override
protected void onPostExecute(Void result) {
super.onPostExecute(result);
// Dismiss the progress dialog
if (pDialog.isShowing())
pDialog.dismiss();
if(wchecker==1)
{
if(sp.getSelectedItem().toString().matches("User"))
{

// Toast.makeText(getApplicationContext(), rollno, 3000).show();


Intent i=new Intent(getApplicationContext(),Userhome.class);
sh.edit().putString("regnumber",number).commit();
sh.edit().putString("passwd",pass).commit();
sh.edit().putString("rollnum",rollno).commit();
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
i.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
Toast.makeText(getApplicationContext(), "success", Toast.LENGTH_SHORT).show();
startActivity(i);
}
else
{
if(number.equals("1")&&pass.equals("admin")||number.equals("2")&&pass.equals("2"))
{
Intent i1=new Intent(getApplicationContext(),Adminhome.class);
i1.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
i1.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
i1.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
Toast.makeText(getApplicationContext(), "success", Toast.LENGTH_SHORT).show();
startActivity(i1);
}
else
{
Toast.makeText(getApplicationContext(), "Wrong Username password",
Toast.LENGTH_SHORT).show();
}
}
}
else
{
Toast.makeText(getApplicationContext(), "Failed", Toast.LENGTH_SHORT).show();
}
}
}
@Override
public void onItemSelected(AdapterView<?>parent, View view, intposition, longid)
{
// TODO Auto-generated method stub
// sname[position]=spin;
}
@Override
public void onNothingSelected(AdapterView<?>parent)
{
// TODO Auto-generated method stub

}
}

Register.java

package com.example.webdata;
import java.io.IOException;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.util.EntityUtils;
import org.json.JSONException;
import org.json.JSONObject;
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.EditText;
import android.widget.ImageButton;
import android.widget.Toast;
public class Register extends Activity implements OnClickListener
{
EditText e1,e2,e3,e4;
ImageButton b;
String number,passwd,cpasswd,rnumber;
@Override
protectedvoid onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.register);
e1=(EditText)findViewById(R.id.edit1);
e2=(EditText)findViewById(R.id.edit2);
e3=(EditText)findViewById(R.id.edit3);
e4=(EditText)findViewById(R.id.roll);
b=(ImageButton)findViewById(R.id.button);
b.setOnClickListener(this);
}
@Override
public void onClick(View v)
{
// TODO Auto-generated method stub
number=e1.getText().toString().trim();
passwd=e2.getText().toString().trim();
cpasswd=e3.getText().toString().trim();
rnumber=e4.getText().toString().trim();
if(number.equals("")||passwd.equals("")||cpasswd.equals("")||rnumber.equals(""))
{
Toast.makeText(getApplicationContext(), "Please enter all value",
Toast.LENGTH_SHORT).show();
}
else if(number.length()>10||number.length()<10)
{
e1.setError("Enter 10 digit value");
e1.setText("");
}
else if(!isValidpass(passwd)||!isValidpass(cpasswd))
{
Toast.makeText(getApplicationContext(), "Please Enter Four Digit
Password", Toast.LENGTH_LONG).show();
return;
}
else if(passwd.equals(cpasswd))
{
new Register1(Register.this).execute();
}
else
{
Toast.makeText(getApplicationContext(),
"PasswordMismatch",Toast.LENGTH_SHORT).show();

}
}
private boolean isValidpass(String passwd2)
{
// TODO Auto-generated method stub
if(passwd2.length()>=4)
{
return true;
}
return false;
}
private class Register1 extends AsyncTask<Void, Void, Void>
{
ProgressDialog pDialog;
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpEntity httpEntity = null;
HttpResponse httpResponse = null;
String response;
int wchecker;
public Register1(Register register) {
// TODO Auto-generated constructor stub
}
@Override
protected void onPreExecute() {
super.onPreExecute();
// Showing progress dialog
pDialog = new ProgressDialog(Register.this);
pDialog.setMessage("Please wait...");
pDialog.setCancelable(false);
pDialog.show();
}
@Override
protected Void doInBackground(Void... arg0) {
// Creating service handler class instance
// ServiceHandler sh = new ServiceHandler();
String url="http://baladatabase.96.lt/Webdata/register.php?
number1="+number+"&passwd1="+passwd+"&roll="+rnumber;
HttpGet httpGet = new HttpGet(url);
try
{
httpResponse = httpClient.execute(httpGet);
httpEntity = httpResponse.getEntity();
response = EntityUtils.toString(httpEntity);
}
catch (IOException e1)
{
// TODO Auto-generated catch block
e1.printStackTrace();
}
// Making a request to url and getting response
//String jsonStr = sh.makeServiceCall(url, ServiceHandler.GET);
Log.d("Response: ", "> " + response);
if (response != null) {
try {
JSONObject jsonObj = new JSONObject(response);
String success=(jsonObj.getString("success"));
Log.d("Success: ", "> " + success);
if(success.matches("Data inserted"))
{
Log.d("Success: ", "Data inserted");
wchecker=1;
}
else
{
Log.d("Error: ", "Data not inserted");
wchecker=0;
}
}
catch (JSONException e)
{
e.printStackTrace();
}
}
else {
Log.e("ServiceHandler", "Couldn't get any data from the url");
}
return null;
}
@Override
protected void onPostExecute(Void result) {
super.onPostExecute(result);
// Dismiss the progress dialog
if (pDialog.isShowing())
pDialog.dismiss();
if(wchecker==1)
{
Toast.makeText(getApplicationContext(), "Success", Toast.LENGTH_SHORT).show();
Intent i=new Intent(getApplicationContext(),Login.class);
startActivity(i);
}
else
{
Toast.makeText(getApplicationContext(), "failed Please try again",
Toast.LENGTH_SHORT).show();
}
}
}
}

Event Creation
Adminhome.java
package com.example.webdata;
import java.io.IOException;
import java.util.Calendar;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.util.EntityUtils;
import org.json.JSONException;
import org.json.JSONObject;
import android.app.Activity;
import android.app.DatePickerDialog;
import android.app.ProgressDialog;
import android.app.TimePickerDialog;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.text.format.DateFormat;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.TimePicker;
import android.widget.Toast;
public class Adminhome extends Activity implements OnClickListener
{
EditText et1,et2,et3;
Button d1,d2;
Button d3;
String name,address,contact;
Button btnDatePicker, btnTimePicker;
EditText txtDate, txtTime;
privateintmYear, mMonth, mDay, mHour, mMinute;
String format;
@Override
protectedvoid onCreate(Bundle savedInstanceState)
{
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.adminhome);
et1=(EditText)findViewById(R.id.s1);
et2=(EditText)findViewById(R.id.s2);
et3=(EditText)findViewById(R.id.s3);
d1=(Button)findViewById(R.id.button1);
d2=(Button)findViewById(R.id.button2);
d3=(Button)findViewById(R.id.button3);
btnDatePicker=(Button)findViewById(R.id.btn_date);
btnTimePicker=(Button)findViewById(R.id.btn_time);
txtDate=(EditText)findViewById(R.id.in_date);
txtTime=(EditText)findViewById(R.id.in_time);
btnDatePicker.setOnClickListener(this);
btnTimePicker.setOnClickListener(this);
d1.setOnClickListener(this);
d2.setOnClickListener(this);
d3.setOnClickListener(this);
}
@Override
publicvoid onClick(View v)
{
// TODO Auto-generated method stub
name=et1.getText().toString().trim();
address=et2.getText().toString().trim();
contact=et3.getText().toString().trim();
// StringBuilder a=new StringBuilder();
// a.append((q.getMonth() + 1)+"/");//month is 0 based
// a.append(q.getDayOfMonth()+"/");
// a.append(q.getYear());
// String date=a.toString();
if(v==d1)
{
Intent i=new Intent(getApplicationContext(),Userrequest.class);
startActivity(i);
}
if(v==d3)
{
Intent i1=new Intent(getApplicationContext(),Login.class);
startActivity(i1);
}
if(v==btnDatePicker)
{
final Calendar c = Calendar.getInstance();
mYear = c.get(Calendar.YEAR);
mMonth = c.get(Calendar.MONTH);
mDay = c.get(Calendar.DAY_OF_MONTH);
DatePickerDialog datePickerDialog = new DatePickerDialog(this,new
DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker view, int year,int monthOfYear, int dayOfMonth) {
txtDate.setText(dayOfMonth + "-" + (monthOfYear + 1) + "-" + year);
}
}, mYear, mMonth, mDay);
datePickerDialog.show();
}
if(v==btnTimePicker)
{

if (DateFormat.is24HourFormat(this)) {
Log.i("control","Format 24");
format=("24");
} else {
Log.i("control","Format 12");
format=("12");
}
final Calendar c = Calendar.getInstance();
mHour = c.get(Calendar.HOUR_OF_DAY);
mMinute = c.get(Calendar.MINUTE);
// Launch Time Picker Dialog
TimePickerDialog timePickerDialog = new TimePickerDialog(this,
new TimePickerDialog.OnTimeSetListener() {
private int hours;
private int minutes;
@Override
public void onTimeSet(TimePicker view, int hourOfDay,int minute)
{
if(format.equals("24"))
{
view.setIs24HourView(true);
} else {
view.setIs24HourView(true);
}
view.setIs24HourView(true);
hours = hourOfDay;
minutes = minute;
String timeSet = "";
if (hours> 12) {
hours -= 12;
timeSet = "PM";
} else if (hours == 0) {
hours += 12;
timeSet = "AM";
} else if (hours == 12){
timeSet = "PM";
}
else
timeSet = "AM";
String min = "";
if (minutes< 10)
min = "0" + minutes ;
else
min = String.valueOf(minutes);
// Append in a StringBuilder
String aTime = new
StringBuilder().append(hours).append(':').append(min).append("").append(timeSet).toString();
txtTime.setText(aTime);
// txtTime.setIs24HourView(true);
// txtTime.setText(hourOfDay + ":" + minute);
}
}, mHour, mMinute, false);
timePickerDialog.show();
}
if(v==d2)
{
if(name.equals("")||address.equals("")||contact.equals(""))
{
Toast.makeText(getApplicationContext(), "Please Insert all the values",
Toast.LENGTH_SHORT).show();
et1.setText("");
et2.setText("");
et3.setText("");
}
else
{
new Add(Adminhome.this).execute();
}
}
}
private class Add extends AsyncTask<Void, Void, Void>
{
ProgressDialog pDialog;
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpEntity httpEntity = null;
HttpResponse httpResponse = null;
String response;
int wchecker;
public Add(Adminhome mainActivity)
{
// TODO Auto-generated constructor stub
}
@Override
protected void onPreExecute()
{
super.onPreExecute();
// Showing progress dialog
pDialog = new ProgressDialog(Adminhome.this);
pDialog.setMessage("Please wait...");
pDialog.setCancelable(false);
pDialog.show();
}
@Override
protected Void doInBackground(Void... arg0) {
// Creating service handler class instance
// ServiceHandler sh = new ServiceHandler();
String url="http://baladatabase.96.lt/Webdata/add.php?
Ename="+name+"&Eplace="+address+"&Econtact="+contact+"&Edate="+txtDate.getText().to
String()+"&Etime="+txtTime.getText().toString();
String ulink=url.replaceAll(" ","%20");
Log.i("0000",ulink);
HttpGet httpGet = new HttpGet(ulink);
try
{
httpResponse = httpClient.execute(httpGet);
httpEntity = httpResponse.getEntity();
response = EntityUtils.toString(httpEntity);
}
catch (IOException e1)
{
// TODO Auto-generated catch block
e1.printStackTrace();
}
// Making a request to url and getting response
//String jsonStr = sh.makeServiceCall(url, ServiceHandler.GET);
Log.d("Response: ", "> " + response);
if (response != null) {
try {
JSONObject jsonObj = new JSONObject(response);
String success=(jsonObj.getString("success"));
Log.d("Success: ", "> " + success);

if(success.matches("Data inserted"))
{
Log.d("Success: ", "Data inserted");
wchecker=1;
}
else
{
Log.d("Error: ", "Data not inserted");
wchecker=0;
}
}
catch (JSONException e) {
e.printStackTrace();
}
}
else {
Log.e("ServiceHandler", "Couldn't get any data from the url");
}
return null;
}
@Override
protected void onPostExecute(Void result) {
super.onPostExecute(result);
// Dismiss the progress dialog
if (pDialog.isShowing())
pDialog.dismiss();
if(wchecker==1)
{
Toast.makeText(getApplicationContext(), "success", Toast.LENGTH_SHORT).show();
et1.setText("");
et2.setText("");
et3.setText("");
txtDate.setText("");
txtTime.setText("");
}
else
{
Toast.makeText(getApplicationContext(), "Failed", Toast.LENGTH_SHORT).show();
}
}
}
}

Listing up the events


Userhome.java
package com.example.webdata;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.DatePicker;
public class Userhome extends Activity implements OnClickListener
{
DatePicker datePicker;
String dat,num1,num2;
String place;
String contact;
String time;
Button butt1,butt2;
@Override
protected void onCreate(Bundle savedInstanceState)
{
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.userhome);
butt1=(Button)findViewById(R.id.button);
butt2=(Button)findViewById(R.id.button1);
datePicker=(DatePicker)findViewById(R.id.datePicker1);
butt1.setOnClickListener(this);
butt2.setOnClickListener(this);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.option, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.logout:
Intent i=new Intent(getApplicationContext(),Login.class);
startActivity(i);
return true;
case R.id.settings:
Intent i1=new Intent(getApplicationContext(),Settings.class);
startActivity(i1);
return true;
default:
return super.onOptionsItemSelected(item);
}
}
@Override
public void onClick(View v)
{
// TODO Auto-generated method stub
if(v==butt2)
{
Intent i=new Intent(getApplicationContext(),Status.class);
startActivity(i);
}
if(v==butt1)
{
StringBuilder build=new StringBuilder();
build.append( datePicker.getDayOfMonth());
build.append("-");
build.append( datePicker.getMonth() + 1);
build.append("-");
build.append( datePicker.getYear());
dat=build.toString();
Intent i=new Intent(getApplicationContext(),GetEvent.class);
i.putExtra("date", dat);
startActivity(i);
}
}}
Userrequest.java

package com.example.webdata;
import java.io.IOException;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.util.EntityUtils;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
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.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.AdapterContextMenuInfo;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;
public class Userrequest extends Activity implements OnItemClickListener
{
ListView l;
int position;
String[] web=new String[100];
String[] ename=new String[100];
String[] date=new String[100];
String[] roll=new String[100];
String[] name=new String[100];
String event,dat,rol,nam;
String sta="waiting";
@Override
protectedvoid onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.userreq);
l=(ListView)findViewById(R.id.lis);
registerForContextMenu(l);
l.setOnItemClickListener(this);
setlistview();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.solu, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.back:
Intent i=new Intent(getApplicationContext(),Adminhome.class);
startActivity(i);
return true;
default:
return super.onOptionsItemSelected(item);
}
}
private void setlistview()
{
// TODO Auto-generated method stub
new user(Userrequest.this).execute();
}
private class user extends AsyncTask<Void, Void, Void>
{
ProgressDialog pDialog;
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpEntity httpEntity = null;
HttpResponse httpResponse = null;
String response;
int wchecker;
JSONArray jsonarray = null;
private user(Userrequest mainActivity) {
// TODO Auto-generated constructor stub
}
@Override
protected void onPreExecute() {
super.onPreExecute();
// Showing progress dialog
pDialog = new ProgressDialog(Userrequest.this);
pDialog.setMessage("Please wait...");
pDialog.setCancelable(false);
pDialog.show();
}
@Override
protected Void doInBackground(Void... arg0)
{
// Creating service handler class instance
// ServiceHandler sh = new ServiceHandler();
String url="http://baladatabase.96.lt/Webdata/getdetail.php?status1="+sta;
HttpGet httpGet = new HttpGet(url);
try
{
httpResponse = httpClient.execute(httpGet);
httpEntity = httpResponse.getEntity();
response = EntityUtils.toString(httpEntity);
}
catch (IOException e1)
{
// TODO Auto-generated catch block
e1.printStackTrace();
}
// Making a request to url and getting response
//String jsonStr = sh.makeServiceCall(url, ServiceHandler.GET);
Log.d("Response: ", "> " + response);
if (response != null)
{
try {
JSONObject jsonObj = new JSONObject(response);
jsonarray=jsonObj.getJSONArray("result");
Log.i("Response jsonstr: ", String.valueOf(jsonarray.length()));
web=new String[jsonarray.length()];
for(int i=0;i<jsonarray.length();i++)
{
JSONObject c = jsonarray.getJSONObject(i);
StringBuffer buffer=new StringBuffer();
buffer.append("Event Name:").append(c.getString("ename")+"\n");
buffer.append("Event Date:").append(c.getString("edate")+"\n");
buffer.append("Students Name:").append(c.getString("name")+"\n");
buffer.append("Roll Number:").append(c.getString("rollno")+"\n");
buffer.append("Department:").append(c.getString("dept")+"\n");
buffer.append("Gender:").append(c.getString("gender")+"\n");
buffer.append("Date of birth:").append(c.getString("dob")+"\n");
buffer.append("Address:").append(c.getString("address")+"\n");
buffer.append("Mail id:").append(c.getString("mail")+"\n");
buffer.append("Mobile number:").append(c.getString("number"));
web[i]=buffer.toString();
ename[i]=c.getString("ename");
date[i]=c.getString("edate");
roll[i]=c.getString("rollno");
name[i]=c.getString("name");
Log.i("DETAILS", web[0]);
}
if(jsonarray.length()>0)
{
Log.d("Success: ", "Data inserted");
wchecker=1;
}
else
{
Log.d("Error: ", "Data not inserted");
wchecker=0;
}
}
catch (JSONException e)
{
e.printStackTrace();
}
}
else {
Log.e("ServiceHandler", "Couldn't get any data from the url");
}
return null;
}
@Override
protected void onPostExecute(Void result)
{
super.onPostExecute(result);
// Dismiss the progress dialog
if (pDialog.isShowing())
pDialog.dismiss();
if(wchecker==1)
{
ArrayAdapter<String>ad=new ArrayAdapter<String>(getApplicationContext(),
android.R.layout.simple_list_item_1,web);
l.setAdapter(ad);
}
else
{
Toast.makeText(getApplicationContext(), "No Recordsfound",Toast.LENGTH_SHORT).show();
}
}
}
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo)
{
super.onCreateContextMenu(menu, v, menuInfo);
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.acceptmain, menu);
}
@Override
public boolean onContextItemSelected(MenuItem item) {
@SuppressWarnings("unused")
AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
switch (item.getItemId())
{
case R.id.Accept:
{
new detail(Userrequest.this).execute();
return true;
}
case R.id.Reject:
{
new reject(Userrequest.this).execute();
return true;
}
case R.id.Back:
Intent i1=new Intent(getApplicationContext(),Adminhome.class);
startActivity(i1);
return true;
default:
return super.onContextItemSelected(item);
}
}
class detail extends AsyncTask<Void, Void, Void>
{
ProgressDialog pDialog;
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpEntity httpEntity = null;
HttpResponse httpResponse = null;
String response;
int wchecker;
JSONArray jsonarray = null;
public detail(Userrequest mainActivity) {
// TODO Auto-generated constructor stub
}
@Override
protected void onPreExecute() {
super.onPreExecute();
// Showing progress dialog
pDialog = new ProgressDialog(Userrequest.this);
pDialog.setMessage("Please wait...");
pDialog.setCancelable(false);
pDialog.show();
event=ename[position];
dat=date[position];
rol=roll[position];
nam=name[position];
}
@Override
protected Void doInBackground(Void... arg0) {
// Creating service handler class instancez
// ServiceHandler sh = new ServiceHandler();
String url="http://baladatabase.96.lt/Webdata/enoticeupdateroom.php?
ename="+event+"&edate="+dat+"&rollno="+rol+"&name="+nam;
Log.i("url", url);
HttpGet httpGet = new HttpGet(url);
try
{
httpResponse = httpClient.execute(httpGet);
httpEntity = httpResponse.getEntity();
response = EntityUtils.toString(httpEntity);
}
catch (IOException e1)
{
// TODO Auto-generated catch block
e1.printStackTrace();
}
// Making a request to url and getting response
//String jsonStr = sh.makeServiceCall(url, ServiceHandler.GET);
Log.d ("Response: ", "> " + response);
if (response != null) {
try {
JSONObject jsonObj = new JSONObject(response);
String success=(jsonObj.getString("success"));
if(success.matches("Data updated"))
{
Log.d("Success: ", "Data updated");
wchecker=1;
}
else
{
Log.d("Error: ", "Data not inserted");
wchecker=0;
}
}
catch (JSONException e) {
e.printStackTrace();
}
}
else {
Log.e("ServiceHandler", "Couldn't get any data from the url");
}
return null;
}
@Override
protected void onPostExecute(Void result)
{
super.onPostExecute(result);
// Dismiss the progress dialog
if (pDialog.isShowing())
pDialog.dismiss();
if(wchecker==1)
{
Toast.makeText(getApplicationContext(), "Accepted", Toast.LENGTH_SHORT).show();
Intent i=new Intent(getApplicationContext(),Userrequest.class);
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
i.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
startActivity(i);
}
else
{
Toast.makeText(getApplicationContext(), "Error", Toast.LENGTH_SHORT).show();
}
}
}
class reject extends AsyncTask<Void, Void, Void>
{
ProgressDialog pDialog;
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpEntity httpEntity = null;
HttpResponse httpResponse = null;
String response;
int wchecker;
JSONArray jsonarray = null;
public reject(Userrequest mainActivity) {
// TODO Auto-generated constructor stub
}
@Override
protected void onPreExecute() {
super.onPreExecute();
// Showing progress dialog
pDialog = new ProgressDialog(Userrequest.this);
pDialog.setMessage("Please wait...");
pDialog.setCancelable(false);
pDialog.show();
event=ename[position];
dat=date[position];
rol=roll[position];
nam=name[position];
}
@Override
protected Void doInBackground(Void... arg0) {
// Creating service handler class instance
// ServiceHandler sh = new ServiceHandler();
String url="http://baladatabase.96.lt/Webdata/reject.php?
ename="+event+"&edate="+dat+"&rollno="+rol+"&name="+nam;
Log.i("url", url);
HttpGet httpGet = new HttpGet(url);
try
{
httpResponse = httpClient.execute(httpGet);
httpEntity = httpResponse.getEntity();
response = EntityUtils.toString(httpEntity);
}
catch (IOException e1)
{
// TODO Auto-generated catch block
e1.printStackTrace();
}
// Making a request to url and getting response
//String jsonStr = sh.makeServiceCall(url, ServiceHandler.GET);
Log.d("Response: ", "> " + response);
if (response != null) {
try {
JSONObject jsonObj = new JSONObject(response);
String success=(jsonObj.getString("success"));
if(success.matches("Data updated"))
{
Log.d("Success: ", "Data updated");
wchecker=1;
}
else
{
Log.d("Error: ", "Data not inserted");
wchecker=0;
}
}
catch (JSONException e) {
e.printStackTrace();
}
}
else {
Log.e("ServiceHandler", "Couldn't get any data from the url");
}
return null;
}
@Override
protected void onPostExecute(Void result)
{
super.onPostExecute(result);
// Dismiss the progress dialog
if (pDialog.isShowing())
pDialog.dismiss();
if(wchecker==1)
{
Toast.makeText(getApplicationContext(), "Rejected", Toast.LENGTH_SHORT).show();
Intent i=new Intent(getApplicationContext(),Userrequest.class);
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
i.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
startActivity(i);
}
else
{
Toast.makeText(getApplicationContext(), "Error", Toast.LENGTH_SHORT).show();
}
}
}
@Override
public void onItemClick(AdapterView<?>parent, View view, int pos,long id) {
// TODO Auto-generated method stub
position=pos;
}
}

GetEvent.java
package com.example.webdata;
import java.io.IOException;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.util.EntityUtils;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
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.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.AdapterContextMenuInfo;
import android.widget.AdapterView.OnItemLongClickListener;
import android.widget.ListView;
import android.widget.Toast;
public class GetEvent extends Activity implements OnItemLongClickListener
{
ListView list;
int pos;
String dat;
String[] web=new String[100];;
String[] name=new String[100];
String[] date=new String[100];
String[] Evname=new String[100];
String e_name,e_date,roll;
String[] Evdate=new String[100];
@Override
protected void onCreate(Bundle savedInstanceState)
{
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.cust);
list=(ListView)findViewById(R.id.list);
Intent i=getIntent();
dat=i.getStringExtra("date");
new date(GetEvent.this).execute();
}
private class date extends AsyncTask<Void, Void, Void>
{
ProgressDialog pDialog;
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpEntity httpEntity = null;
HttpResponse httpResponse = null;
String response;
int wchecker;
private JSONArray jsonArray;
public date(GetEvent getEvent) {
// TODO Auto-generated constructor stub
}
@Override
protected void onPreExecute() {
super.onPreExecute();
// Showing progress dialog
pDialog = new ProgressDialog(GetEvent.this);
pDialog.setMessage("Please wait...");
pDialog.setCancelable(false);
pDialog.show();
}
@Override
protected Void doInBackground(Void... arg0)
{
// Creating service handler class instance
// ServiceHandler sh = new ServiceHandler();
String url="http://baladatabase.96.lt/Webdata/appreviewgetalldetails.php?Date="+dat;
HttpGet httpGet = new HttpGet(url);
try
{
httpResponse = httpClient.execute(httpGet);
httpEntity = httpResponse.getEntity();
response = EntityUtils.toString(httpEntity);
}
catch (IOException e1)
{
// TODO Auto-generated catch block
e1.printStackTrace();
}
// Making a request to url and getting response
//String jsonStr = sh.makeServiceCall(url, ServiceHandler.GET);
Log.d("Response: ", "> " + response);
if (response != null)
{
try {
JSONObject jsonObj = new JSONObject(response);
jsonArray=jsonObj.getJSONArray("result");
Log.i("Response jsonstr: ", String.valueOf(jsonArray.length()));
web=new String[jsonArray.length()];
name=new String[jsonArray.length()];
date=new String[jsonArray.length()];
for(int i=0;i<jsonArray.length();i++)
{
JSONObject c = jsonArray.getJSONObject(i);
StringBuffer buffer=new StringBuffer();
buffer.append("Event Name:").append(c.getString("Ename")+"\n");
buffer.append("Event Address:").append(c.getString("Eplace")+"\n");
buffer.append("Event Contact:").append(c.getString("Econtact")+"\n");
buffer.append("Event Date:").append(c.getString("Edate")+"\n");
buffer.append("Event Time:").append(c.getString("Etime"));
web[i]=buffer.toString();
name[i]=c.getString("Ename");
date[i]=c.getString("Edate");
// place=c.getString("Eplace")+"\n";
// contact=c.getString("Econtact")+"\n";
// time=c.getString("Etime");
wchecker=1;
Log.i("DETAILS", web[0]);
}
if(jsonArray.length()>0)
{
Log.d("Success: ", "Data inserted");
wchecker=1;
}
else
{
Log.d("Error: ", "Data not inserted");
wchecker=0;
}
}
catch (JSONException e) {
e.printStackTrace();
}
}
else {
Log.e("ServiceHandler", "Couldn't get any data from the url");
}
return null;
}
@Override
protected void onPostExecute(Void result)
{
super.onPostExecute(result);
// Dismiss the progress dialog
if (pDialog.isShowing())
pDialog.dismiss();
if(wchecker==1)
{
createcustom();
}
else
{
Toast.makeText(getApplicationContext(), "No Event Found", Toast.LENGTH_SHORT).show();
}
}
}
Private void createcustom() {
// TODO Auto-generated method stub
Customlistview adapter=new Customlistview(GetEvent.this, web);
list.setAdapter(adapter);
registerForContextMenu(list);
list.setOnItemLongClickListener(this);
}

@Override
public boolean onCreateOptionsMenu(Menu menu)
{
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.solu, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.back:
Intent i=new Intent(getApplicationContext(),Userhome.class);
startActivity(i);
return true;
default:
return super.onOptionsItemSelected(item);
}
}
@Override
public void onCreateContextMenu(ContextMenu menu, View v,ContextMenuInfo menuInfo)
{
super.onCreateContextMenu(menu, v, menuInfo);
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.main, menu);
}
@Override
public boolean onContextItemSelected(MenuItem item) {
@SuppressWarnings("unused")
AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
switch (item.getItemId())
{
case R.id.REGISTER:
String e_name=name[pos];
String e_date=date[pos];
Intent i=new Intent(GetEvent.this,Register2.class);
i.putExtra("name1", e_name);
i.putExtra("date1", e_date);
startActivity(i);
return true;
case R.id.BACK:
Intent i1=new Intent(getApplicationContext(),Userhome.class);
startActivity(i1);
return true;
default:
return super.onContextItemSelected(item);
}
}
@Override
public boolean onItemLongClick(AdapterView<?>parent, View view, int position, long id)
{
// TODO Auto-generated method stub
pos=position;
return false;
}
}
Settings.java

package com.example.webdata;
import java.io.IOException;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.util.EntityUtils;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.content.SharedPreferences;
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.TextView;
import android.widget.Toast;
public class Settings extends Activity implements OnClickListener
{
EditText e1,e2,e3;
Button b1,b2;
TextView t;
String uname,upass;
String pass1,pass2,pass3;
SharedPreferences sh=null;
SharedPreferences.Editor edit;
@Override
protected void onCreate(Bundle savedInstanceState)
{
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.settings);
e1=(EditText)findViewById(R.id.et1);
e2=(EditText)findViewById(R.id.et2);
e3=(EditText)findViewById(R.id.et3);
b1=(Button)findViewById(R.id.submit);
b2=(Button)findViewById(R.id.logout);
t=(TextView)findViewById(R.id.change);
t.setOnClickListener(this);
b1.setOnClickListener(this);
b2.setOnClickListener(this);
sh=getSharedPreferences("share",0);
edit=sh.edit();
uname=sh.getString("regnumber",null);
upass=sh.getString("passwd",null);
}
@Override
public void onClick(View v)
{
// TODO Auto-generated method stub
pass1=e1.getText().toString().trim();
pass2=e2.getText().toString().trim();
pass3=e3.getText().toString().trim();
if(v==t)
{
e1.setVisibility(View.VISIBLE);
e2.setVisibility(View.VISIBLE);
e3.setVisibility(View.VISIBLE);
b1.setVisibility(View.VISIBLE);
}
if(v==b2)
{
Intent i1=new Intent(getApplicationContext(),Login.class);
i1.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
i1.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
i1.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
startActivity(i1);
}
if(v==b1)
{
if(pass1.equals("")||pass2.equals("")||pass3.equals(""))
{
Toast.makeText(getApplicationContext(), "Enter Fields", 4000).show();
}
else
{
if(pass1.equals(upass))
{
if(pass2.equals(pass3))
{
new Changpsd(Settings.this).execute();
}
else
{
Toast.makeText(getApplicationContext(), "pAssword mismatch", 2000).show();
}
}
else
{
Toast.makeText(getApplicationContext(), "InVALID Old pAssword", 2000).show();
}
}
}
}
private class Changpsd extends AsyncTask<Void, Void, Void>
{
ProgressDialog pDialog;
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpEntity httpEntity = null;
HttpResponse httpResponse = null;
String response;
int wchecker;
public Changpsd(Settings mainActivity)
{
// TODO Auto-generated constructor stub
}
@Override
protected void onPreExecute() {
super.onPreExecute();
/ / Showing progress dialog
pDialog = new ProgressDialog(Settings.this);
pDialog.setMessage("Please wait...");
pDialog.setCancelable(false);
pDialog.show();
}
@Override
protected Void doInBackground(Void... arg0) {
// Creating service handler class instance
// ServiceHandler sh = new ServiceHandler();
String url="http://baladatabase.96.lt/Webdata/Setting.php?
username="+uname+"&password="+pass2;
Log.i("url", url);
HttpGet httpGet = new HttpGet(url);
try
{
httpResponse = httpClient.execute(httpGet);
httpEntity = httpResponse.getEntity();
response = EntityUtils.toString(httpEntity); }
catch (IOException e1)
{
// TODO Auto-generated catch block
e1.printStackTrace();
}
// Making a request to url and getting response
//String jsonStr = sh.makeServiceCall(url, ServiceHandler.GET);
Log.d("Response: ", "> " + response);
if (response != null) {
try {
JSONObject jsonObj = new JSONObject(response);
String success=(jsonObj.getString("success"));
Log.d("Success: ", "> " + success);
if(success.matches("Data inserted"))
{
Log.d("Success: ", "Data inserted");
wchecker=1;
}
else
{
Log.d("Error: ", "Data not inserted");
wchecker=0;
}
}
catch (JSONException e)
{
e.printStackTrace();
}
}
else
{
Log.e("ServiceHandler", "Couldn't get any data from the url");
}
return null;
}
@Override
protected void onPostExecute(Void result)
{
super.onPostExecute(result);
// Dismiss the progress dialog
if (pDialog.isShowing())
pDialog.dismiss();
if(wchecker==1)
{
Toast.makeText(getApplicationContext(), "Updated Your Current Password is:"+pass2,
Toast.LENGTH_SHORT).show();
Intent i=new Intent(getApplicationContext(),Settings.class);
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
i.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
e1.setText("");
e2.setText("");
e3.setText("");
sh.edit().putString("passwd",pass2).commit();
}
else
{
Toast.makeText(getApplicationContext(), "Not Modified", Toast.LENGTH_SHORT).show();
}
}
}
}
User registration for events
Register2.java
package com.example.webdata;
import java.io.IOException;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.util.EntityUtils;
import org.json.JSONException;
import org.json.JSONObject;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.AsyncTask;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.animation.AnimationUtils;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
public class Register2 extends Activity implements OnClickListener, OnItemSelectedListener
{
EditText e3,e4,e5,e6,e7;
Spinner s,s1;
ImageButton b,b1;
String[] Dep={"Select your
department","CSE","EEE","ECE","Mech","IT","CIVIL","ANE","MCA","MBA","Others"};
String[] Gen={"Gender","Male","Female"};
String text1,text2,text3,text4,text5,gender,text6,text7;
TextView txt1,txt2;
String Evnames;
String dates;
SharedPreferences sp=null;
SharedPreferences.Editor edit;
String rnum;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.register2);
try
{
s1=(Spinner)findViewById(R.id.ed);
e3=(EditText)findViewById(R.id.edit3);
e4=(EditText)findViewById(R.id.edit4);
e5=(EditText)findViewById(R.id.edit5);
e6=(EditText)findViewById(R.id.edit6);
e7=(EditText)findViewById(R.id.edit7);
txt1=(TextView)findViewById(R.id.textView1);
txt2=(TextView)findViewById(R.id.textView2);
s=(Spinner)findViewById(R.id.spinner1);
b=(ImageButton)findViewById(R.id.button);
b1=(ImageButton)findViewById(R.id.button1);
Intent i=getIntent();
Evnames=i.getStringExtra("name1");
dates=i.getStringExtra("date1");
// Toast.makeText(getApplicationContext(), Evnames+dates, 3000).show();
sp=getSharedPreferences("share",0);
edit=sp.edit();
rnum=sp.getString("rollnum",null);
// Toast.makeText(getApplicationContext(), rnum, 2000).show();
txt1.setText("Event Name:"+Evnames);
txt2.setText("Event Date:"+dates);
android.view.animation.Animation animation2 = AnimationUtils.loadAnimation(this,
R.anim.move1);
txt1.startAnimation(animation2);
android.view.animation.Animation animation = AnimationUtils.loadAnimation(this,
R.anim.move1);
txt2.startAnimation(animation);
s.setOnItemSelectedListener(this);
b.setOnClickListener(this);
b1.setOnClickListener(this);
ArrayAdapter<String>ad=new
ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,Gen);
s.setAdapter(ad);
ArrayAdapter<String>ss=new
ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,Dep);
s1.setAdapter(ss);
}
catch(Exception e)
{
Toast.makeText(getApplicationContext(), e.getMessage(), Toast.LENGTH_SHORT).show();
}
}
@Override
public void onClick(View v)
{
// TODO Auto-generated method stub
if(v==b1)
{
Intent i2=new Intent(getApplicationContext(),Userhome.class);
startActivity(i2);
}

if(v==b)
{

text2=s1.getSelectedItem().toString();
text3=e3.getText().toString().trim();
text4=e4.getText().toString().trim();
text5=e5.getText().toString().trim();
text6=e6.getText().toString().trim();
text7=e7.getText().toString().trim();
// text8=txt1.getText().toString();
// text9=txt2.getText().toString();
gender=s.getSelectedItem().toString();
if(text3.equals("")||text4.equals("")||text5.equals("")||text6.equals("")||text7.equals(""))
{
Toast.makeText(getApplicationContext(), "Please enter all the values",
Toast.LENGTH_SHORT).show();
e3.setText("");
e4.setText("");
e5.setText("");
e6.setText("");
e7.setText("");
s.setSelection(0);
s1.setSelection(0);
}
else if(text7.length()>10||text7.length()<10)
{
e7.setError("Enter 10digit Mobile Number");
}
else if(!isValidEmail(text6))
{
Toast.makeText(getApplicationContext(), "Enter Valid Email Address",
Toast.LENGTH_LONG).show();
return;
}
else if(gender.equals("Gender"))
{
Toast.makeText(getApplicationContext(), "Please select one",
Toast.LENGTH_SHORT).show();
}
else if(text2.equals("Select your department"))
{
Toast.makeText(getApplicationContext(), "Please select one",
Toast.LENGTH_SHORT).show();
}
else
{
new Register3(Register2.this).execute();

}
}
}
private boolean isValidEmail(String text62)
{
// TODO Auto-generated method stub
return !TextUtils.isEmpty(text62) &&
android.util.Patterns.EMAIL_ADDRESS.matcher(text62).matches();
}
private class Register3 extends AsyncTask<Void, Void, Void>
{
ProgressDialog pDialog;
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpEntity httpEntity = null;
HttpResponse httpResponse = null;
String response;
int wchecker;
public Register3(Register2 register) {
// TODO Auto-generated constructor stub
}
@Override
protected void onPreExecute() {
super.onPreExecute();
// Showing progress dialog
pDialog = new ProgressDialog(Register2.this);
pDialog.setMessage("Please wait...");
pDialog.setCancelable(false);
pDialog.show();
}
@Override
protected Void doInBackground(Void... arg0) {
// Creating service handler class instance
// ServiceHandler sh = new ServiceHandler();
String url="http://baladatabase.96.lt/Webdata/Userregister.php?
ronumber="+rnum+"&Evname="+Evnames+"&Edate="+dates+"&dept="+text2+"&name="+te
xt3+"&gender="+gender+"&dob="+text4+"&address="+text5+"&mail="+text6+"&number="+t
ext7;
String ulink=url.replaceAll(" ","%20");
HttpGet httpGet = new HttpGet(ulink);
try
{
httpResponse = httpClient.execute(httpGet);
httpEntity = httpResponse.getEntity();
response = EntityUtils.toString(httpEntity);
}
catch (IOException e1)
{
// TODO Auto-generated catch block
e1.printStackTrace();
}
// Making a request to url and getting response
//String jsonStr = sh.makeServiceCall(url, ServiceHandler.GET);
Log.d("Response: ", "> " + response);
if (response != null) {
try {
JSONObject jsonObj = new JSONObject(response);
String success=(jsonObj.getString("success"));
Log.d("Success: ", "> " + success);
if(success.matches("Data inserted"))
{
Log.d("Success: ", "Data inserted");
wchecker=1;
}
else
{
Log.d("Error: ", "Data not inserted");
wchecker=0;
}
}
catch (JSONException e)
{
e.printStackTrace();
}
}
else {
Log.e("ServiceHandler", "Couldn't get any data from the url");
}
return null;
}
@Override
protected void onPostExecute(Void result) {
super.onPostExecute(result);
// Dismiss the progress dialog
if (pDialog.isShowing())
pDialog.dismiss();
if(wchecker==1)
{
Toast.makeText(getApplicationContext(), "Registered Successfully",
Toast.LENGTH_SHORT).show();
s1.setSelection(0);
e3.setText("");
e4.setText("");
e5.setText("");
e6.setText("");
e7.setText("");
s.setSelection(0);
}
else
{
Toast.makeText(getApplicationContext(), "failed", Toast.LENGTH_SHORT).show();
s1.setSelection(0);
e3.setText("");
e4.setText("");
e5.setText("");
e6.setText("");
e7.setText("");
s.setSelection(0);
}
}
}
@Override
public void onItemSelected(AdapterView<?>parent, View view, int position, longid) {
// TODO Auto-generated method stub
}
@Override
public void onNothingSelected(AdapterView<?>parent) {
// TODO Auto-generated method stub
}
}

Registration status
Status.java
package com.example.webdata;
import java.io.IOException;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.util.EntityUtils;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;
public class Status extends Activity
{
ListView l;
String num1,rnum;
String[] web=new String[100];
SharedPreferences sp=null;
SharedPreferences.Editor edit;
@Override
protected void onCreate(Bundle savedInstanceState)
{
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.status);
sp=getSharedPreferences("share",0);
edit=sp.edit();
num1=sp.getString("regnumber",null);
rnum=sp.getString("rollnum",null);
l=(ListView)findViewById(R.id.listVi);
// android.view.animation.Animation animation2 = AnimationUtils.loadAnimation(this,
R.anim.move1);
// l.startAnimation(animation2);
setlist();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.ref, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.refresh:
setlist();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
private void setlist()
{
// TODO Auto-generated method stub
new built(Status.this).execute();
}
private class built extends AsyncTask<Void, Void, Void>
{
Context _context;
ProgressDialog pDialog;
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpEntity httpEntity = null;
HttpResponse httpResponse = null;
String response;
int wchecker;
JSONArray jsonarray = null;
public built(Context Status)
{
// TODO Auto-generated constructor stub
_context=Status;
}
@Override
protected void onPreExecute() {
super.onPreExecute();
// Showing progress dialog
pDialog = new ProgressDialog(_context);
pDialog.setMessage("Please wait...");
pDialog.setCancelable(false);
pDialog.show();
}
@Override
protected Void doInBackground(Void... arg0)
{
String url="http://baladatabase.96.lt/Webdata/StatusGet.php?rollno="+rnum;
HttpGet httpGet = new HttpGet(url);
try
{
httpResponse = httpClient.execute(httpGet);
httpEntity = httpResponse.getEntity();
response = EntityUtils.toString(httpEntity);
}
catch (IOException e1)
{
// TODO Auto-generated catch block
e1.printStackTrace();
}
Log.d("Response: ", "> " + response);
if (response != null)
{
try {
JSONObject jsonObj = new JSONObject(response);
jsonarray=jsonObj.getJSONArray("result");
Log.i("Response jsonstr: ", String.valueOf(jsonarray.length()));
web=new String[jsonarray.length()];
for(int i=0;i<jsonarray.length();i++)
{
JSONObject c = jsonarray.getJSONObject(i);
StringBuffer buffer=new StringBuffer();
buffer.append("Event Name:").append(c.getString("ename")+"\n");
buffer.append("Event Date:").append(c.getString("edate")+"\n");
buffer.append("Status:").append(c.getString("status"));
web[i]=buffer.toString();
wchecker=1;
Log.i("DETAILS", web[0]);
}
if(jsonarray.length()>0)
{
Log.d("Success: ", "Data inserted");
wchecker=1;
}
else
{
Log.d("Error: ", "Data not inserted");
wchecker=0;
}
catch (JSONException e) {
e.printStackTrace();
}
}
else {
Log.e("ServiceHandler", "Couldn't get any data from the url");
}
return null;
}
@Override
protected void onPostExecute(Void result)
{
super.onPostExecute(result);
// Dismiss the progress dialog
if (pDialog.isShowing())
pDialog.dismiss();
if (wchecker==1)
{
// Toast.makeText(getApplicationContext(), ""+web, 4000).show();
ArrayAdapter<String>ad=new
ArrayAdapter<String>(_context,android.R.layout.simple_list_item_1,web);
l.setAdapter(ad);
}
else
{
Toast.makeText(getApplicationContext(), "No Records found",Toast.LENGTH_SHORT).show();
}
}
}
}

Customlistview.java
package com.example.webdata;
import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
public class Customlistview extends ArrayAdapter<String> {
private final Activity context;
private final String[] web;
public Customlistview(Activity context, String[] web) {
super(context,R.layout.updatetableimplement, web);
// TODO Auto-generated constructor stub
this.context=context;
this.web=web;
}
public View getView(intposition,View view,ViewGroup parent)
{
LayoutInflater inflator=context.getLayoutInflater();
View rowview=inflator.inflate(R.layout.updatetableimplement,null,true);
TextView txtund=(TextView)rowview.findViewById(R.id.textView1);
txtund.setText(web[position]);
return rowview;
}}

You might also like