COLLEGE PHONE BOOK Final documentation
-
Upload
bhadra-gowdra -
Category
Mobile
-
view
558 -
download
5
Transcript of COLLEGE PHONE BOOK Final documentation
Mini Project Report
On
“COLLEGE PHONE BOOK”
Submitted in partial fulfillment of the.
Requirements for the award of the degree of
Bachelor of Technology
In
Computer Science & Engineering
By
M.SHANMUKHI(13R21A05D9)
M.SAI KRISHNA(13R21A05E2)
P.YAMINI(13R21A05F0)
N.DINESH(13R21A05E7)
Under the guidance of Mrs. B.MADHURAVANI(Assoc. professor)
Department of Computer Science & Engineering
MLR INSTITUTE OF TECHNOLOGY
(Affiliated to Jawaharlal Nehru Technological University, Hyderabad)
DUNDIGAL(V), QUTHBULLAPUR Mdl), HYDERABAD -500 043.
2016-17
Department of Computer Science & Engineering
MLR INSTITUTE OF TECHNOLOGY
(Affiliated to Jawaharlal Nehru Technological University, Hyderabad)
DUNDIGAL(V), QUTHBULLAPUR Mdl), HYDERABAD -500 043.
.
CERTIFICATE
This is to certify that the project entitled “COLLEGE PHONE BOOK” by
M.SHANMUKHI(13R21A05D9),M.SAIKRISHNA(13R21A05E2),P.YAMINI(13R21A05F0
N.DINESH(13R21A05E7)has been submitted in the partial fulfillment of the requirements for
the award of degree of Bachelor of Technology in Computer Science and Engineering from
Jawaharlal Nehru Technological University, Hyderabad. The results embodied in this project
have not been submitted to any other University or Institution for the award of any degree or
diploma.
Internal Guide Head of the Department
Mrs. B.MADHURAVANI Prof. N. CHANDRA SEKHAR REDDY
Assoc. professor
External Examiner
DECLARATION
I hereby declare that the project entitled “COLLEGE PHONE BOOK” is the work
done during the period from June 2016 to October 2016 and is submitted in the partial
fulfillment of the requirements for the award of degree of Bachelor of technology in computer
Science and Engineering from Jawaharlal Nehru Technology University, Hyderabad. The results
embodied in this project have not been submitted to any other university or Institution for the
award of any degree or diploma.
M.SHANMUKHI(13R21A05D9)
M.SAIKRISHNA(13R21A05E2)
P.YAMINI(13R21A05F0)
N.DINESH(13R21A05E7)
ACKNOWLEDGEMENT
There are many people who helped me directly and indirectly to complete my project
successfully. I would like to take this opportunity to thank one and all.
First of all I would like to express my deep gratitude towards my internal guide
Mrs.B.Madhuravani ,Associate Professor. Department of CSE for her support in the
completion of my dissertation. I wish to express my sincere thanks to, Prof. N.
Chandrashekhar Reddy HOD, Dept. of CSE and also to our principal Dr. P BHASKARA
REDDY for providing the facilities to complete the dissertation.
I would like to thank all our faculty and friends for their help and constructive criticism
during the project period. Finally, I am very much indebted to our parents for their moral support
and encouragement to achieve goals.
M.SHANMUKHI(13R21A05D9)
M.SAIKRISHNA(13R21A05E2)
P.YAMINI(13R21A05F0)
N.DINESH(13R21A05E7)
ABSTRACT
The project which we are doing is about “COLLEGE PHONE BOOK”. It is about storing the
information or details of each individual student studying in their respective departments, which
displays the name of the student, phone number(s) of the each individual student. This will be a
very useful concept as it will give the college management or the department head to know the
complete information of the student studying in that department. This project is based on the
database in which we can store and retrieve all the information regarding students and what all
we require.
Database is a structured format. So if we store in the database, we can retrieve that particular
information by giving a command directly. There is no process for installing database for
mobile-phone applications. Whenever the database is needed, then only the database is created
through coding. Here we have the feasibility to give input, change the data and to delete it if we
are not in need of it anymore, with the following option in the first screen – COLLEGE
PHONEBOOK.
SCOPE: Our project includes
Maintenance of faculty data
Maintenance of student data
Enrolling new students
Displaying particular student/faculty data
CONTENTS
Certification i
Declaration ii
Acknowledgement iii
Abstract iv
1. Introduction 1
2. Literature Survey 2
Existing System
Proposed System
3. Requirement Analysis 3
Hardware Requirements
Software Requirements
Feasibility Study
4. Implementation 4
Problem Definition
Modules Description
System Architecture
5. System Design 6
6. UML Diagrams
7. Coding 9
8. System Testing 16
9. Screen Shots 23
10. Limitations and Future Enhancement 38
11. Conclusion 40
12. Bibliography
INTRODUCTION
The project which we are doing is about “COLLEGE PHONEBOOK”. It is about storing the
information or details of each individual student studying in their respective departments, which
displays the name of the student, phone number(s) of the each individual student. This will be a
very useful concept as it will give the college management or the department head to know the
complete information of the student studying in that department.
Database is a structured format. So if we store in the database, we can retrieve that particular
information by giving a command directly. There is no process for installing database for
mobile-phone applications. Whenever the database is needed, then only the database is created
through coding. Here we have the feasibility to give input, change the data and to delete it if we
are not in need of it anymore, with the following option in the first screen – COLLEGE
PHONEBOOK.
LITERATURE SURVEY
Literature survey is the most important step in software development process. Before developing
the tool it is necessary to determine the time factor, economy and company strength. Once these
things are satisfied, then next steps are to determine which operating system and language can be
used for developing the tool. Once the programmers start building the tool the programmers need
lot of external support. This support can be obtained from senior programmers, from book or
from websites. Before building the system the above consideration are taken into account for
developing the proposed system.
EXISTING SYSTEM:
User need to add all the contacts in the phone manually. They can also update and delete
however it is very tedious process. They don’t have provision to email from the contacts
.
PROPOSED SYSTEM:
In this application every one can maintain the details about all the students in their
mobile only. So we can easily reach all the students of the college. It consists of student
information like name, phone number. From this application we can call.
REQUIRIMENT ANALYSIS
Hardware Specification:
Intel Pentium or More
4 GB Ram
PC with 20GB
Software Specification:
WINDOWS OS
Coding Language: Java 8.0
ToolKit : Android Studio
Database: SQLite
Feasibility study:
The feasibility of the project is analyzed in this phase and business proposal is put forth
with a very general plan for the project and some cost estimates. During system analysis the
feasibility study of the proposed system is to be carried out. This is to ensure that the proposed
system is not a burden to the company. For feasibility analysis, some understanding of the major
requirements for the system is essential.
Three key considerations involved in the feasibility analysis are
ECONOMICAL FEASIBILITY
TECHNICAL FEASIBILITY
SOCIAL FEASIBILITY
ECONOMICAL FEASIBILITY
This study is carried out to check the economic impact that the system will have on
the organization. The amount of fund that the company can pour into the research and
development of the system is limited. The expenditures must be justified. Thus the developed
system as well within the budget and this was achieved because most of the technologies
used freely available. Only the customized products had to be purchased.
TECHNICAL FEASIBILITY
This study is carried out to check the technical feasibility, that is, the technical requirements
of the system. Any system developed must not have a high demand on the available technical
resources. This will lead to high demands on the available technical resources. This will lead to
high demands being placed on the client. The developed system must have a modest
requirement, as only minimal or null changes are required for implementing this system.
SOCIAL FEASIBILITY
The aspect of study is to check the level of acceptance of the system by the user. This
includes the process of training the user to use the system efficiently. The user must not feel
threatened by the system, instead must accept it as a necessity. The level of acceptance by the
users solely depends on the methods that are employed to educate the user about the system
and to make him familiar with it.
IMPLEMENTATION
Problem Definition:
The main purpose of the college phone book app is to simplify the manual work
and make it computerized and give them a clear vision on the details of a student and faculty
such as their mail id, phone no.
Module Description
Admin module
Faculty module
Student module
Modules:
Admin module
This module is based upon the login process and subject details. The login specifies the user
mode as admin. Login process include login, logout, password. The user can login only if the
user enters the username and password .In this module the admin will be able to add the details
of the student and can change the password.
Faculty module
All the information about the faculty related data will be available such as name, Email id and
phone number etc for the users .In this module it is able to make a call to the faculty also.
Student module
All the information about the student related data will be available such as name, Email id and
phone number etc for the users. The information will include an overview of the student whose
details are controlled by administrator
System Architecture
Android is a Linux-based operating system for mobile devices such as smart phones and tablet
computers. It is developed by the Open Handset Alliance led by Google . Android has a large
community of developers writing applications ("apps") that extend the functionality of the
devices. Developers write primarily in a customized version of Java.
Android architecture
Android consists of a kernel based on the Linux kernel, with middleware, libraries and APIs written in C and application software running on an application framework which includes Java-compatible libraries based on Apache Harmony. Android uses the Dalvik virtual machine with
just- in-time compilation to run Dalvik dex-code (Dalvik Executable), which is usually translated from Java byte code.
Android's kernel is based on the Linux kernel and has further architecture changes by Google
outside the typical Linux kernel development cycle. Android does not have a native X Window System nor does it support the full set of standard GNU libraries, and this makes it difficult to port existing Linux applications or libraries to Android.
Application Framework
By providing an open development platform, Android offers developers the ability to build extremely rich
and innovative applications. Developers are free to take advantage of the device hardware, access location
information, run background services, set alarms, add notifications to the status bar, and much, much
more.
Developers have full access to the same framework APIs used by the core applications. The application
architecture is designed to simplify the reuse of components; any application can publish its capabilities
and any other application may then make use of those capabilities (subject to security constraints enforced
by the framework). This same mechanism allows components to be replaced by the user.
Underlying all applications is a set of services and systems, including:
A rich and extensible set of Views that can be used to build an application, including lists, grids, text boxes, buttons, and even an embeddable web browser
Content Providers that enable applications to access data from other applications (such as Contacts), or to share their own data
A Resource Manager, providing access to non-code resources such as localized strings, graphics, and layout files
A Notification Manager that enables all applications to display custom alerts in the status bar An Activity Manager that manages the lifecycle of applications and provides a common
navigation back stack
Libraries
Android includes a set of C/C++ libraries used by various components of the Android system. These
capabilities are exposed to developers through the Android application framework. Some of the core
libraries are listed below:
System C library - a BSD-derived implementation of the standard C system library (libc), tuned for embedded Linux-based devices
Media Libraries - based on PacketVideo's OpenCORE; the libraries support playback and recording of many popular audio and video formats, as well as static image files, including MPEG4, H.264, MP3, AAC, AMR, JPG, and PNG
Surface Manager - manages access to the display subsystem and seamlessly composites 2D and 3D graphic layers from multiple applications
LibWebCore - a modern web browser engine which powers both the Android browser and an embeddable web view
SGL - the underlying 2D graphics engine 3D libraries - an implementation based on OpenGL ES 1.0 APIs; the libraries use either hardware
3D acceleration (where available) or the included, highly optimized 3D software rasterizer FreeType - bitmap and vector font rendering SQLite - a powerful and lightweight relational database engine available to all applications
Android Runtime
Android includes a set of core libraries that provides most of the functionality available in the core libraries of the Java programming language.
Every Android application runs in its own process, with its own instance of the Dalvik virtual machine. Dalvik has been written so that a device can run multiple VMs efficiently. The Dalvik
VM executes files in the Dalvik Executable (.dex) format which is optimized for minimal memory footprint. The VM is register-based, and runs classes compiled by a Java language compiler that have been transformed into the .dex format by the included "dx" tool.
The Dalvik VM relies on the Linux kernel for underlying functionality such as threading and low-level memory management.
Linux Kernel
Android relies on Linux version 2.6 for core system services such as security, memory management, process management, network stack, and driver model. The kernel also acts as an
abstraction layer between the hardware and the rest of the software stack.
Installing the SDK
Step 1. Preparing Your Development Computer
Before getting started with the Android SDK, take a moment to confirm that your development computer meets the System Requirements. In particular, you might need to install the JDK, if
you don't have it already. If you will be developing in Eclipse with the Android Development Tools (ADT) Plugin—the
recommended path if you are new to Android—make sure that you have a suitable version of Eclipse installed on your computer as described in the System Requirements document.
If you need to install Eclipse, you can download it from this location:
http://www.eclipse.org/downloads/
The "Eclipse Classic" version is recommended. Otherwise, a Java or RCP version of Eclipse is
recommended.
Step 2. Downloading the SDK Starter Package
The SDK starter package is not a full development environment—it includes only the core SDK
Tools, which you can use to download the rest of the SDK components (such as the latest Android platform).
If you haven't already, get the latest version of the SDK starter package from the SDK download
page.
If you downloaded a .zip or .tgz package (instead of the SDK installer), unpack it to a safe location on your machine. By default, the SDK files are unpacked into a directory named android-
sdk-<machine-platform>.
If you downloaded the Windows installer ( .exe file), run it now and it will check whether the
proper Java SE Development Kit (JDK) is installed (installing it, if necessary), then install the SDK Tools into a default location (which you can modify).
Make a note of the name and location of the SDK directory on your system—you will need to refer to the SDK directory later, when setting up the ADT plugin and when using the SDK tools
from the command line.
Step 3. Installing the ADT Plugin for Eclipse
Android offers a custom plugin for the Eclipse IDE, called Android Development Tools (ADT),
that is designed to give you a powerful, integrated environment in which to build Android applications. It extends the capabilites of Eclipse to let you quickly set up new Android projects, create an application UI, debug your applications using the Android SDK tools, and even export
signed (or unsigned) APKs in order to distribute your application. In general, developing in Eclipse with ADT is a highly recommended approach and is the fastest way to get started with
Android. If you'd like to use ADT for developing Android applications, install it now. Read Installing the ADT Plugin for step-by-step installation instructions, then return here to continue the last step in
setting up your Android SDK.
If you prefer to work in a different IDE, you do not need to install Eclipse or ADT. Instead, you can directly use the SDK tools to build and debug your application. The Introduction to Android application development outlines the major steps that you need to complete when develop ing in
Eclipse or other IDEs.
Step 4. Adding Platforms and Other Components
The last step in setting up your SDK is using the Android SDK and AVD Manager (a tool included in the
SDK starter package) to download essential SDK components into your development environment.
The SDK uses a modular structure that separates the major parts of the SDK—Android platform versions,
add-ons, tools, samples, and documentation—into a set of separately installable components. The SDK
starter package, which you've already downloaded, includes only a single component: the latest version of
the SDK Tools. To develop an Android application, you also need to download at least one Android
platform and the associated platform tools. You can add other components and platforms as well, which is
highly recommended.
If you used the Windows installer, when you complete the installation wizard, it will launch the Android
SDK and AVD Manager with a default set of platforms and other components selected for you to install.
Simply click Install to accept the recommended set of components and install them. You can then skip to
Step 5, but we recommend you first read the section about the Available Components to better understand
the components available from the Android SDK and AVD Manager.
You can launch the Android SDK and AVD Manager in one of the following ways:
From within Eclipse, select Window > Android SDK and AVD Manager. On Windows, double-click the SDK Manager.exe file at the root of the Android SDK directory. On Mac or Linux, open a terminal and navigate to the tools/ directory in the Android SDK, then
execute: android
Available Components
By default, there are two repositories of components for your SDK: Android Repository and Third party
Add-ons.
The Android Repository offers these types of components:
SDK Tools — Contains tools for debugging and testing your application and other utility tools. These tools are installed with the Android SDK starter package and receive periodic updates. You can access these tools in the <sdk>/tools/ directory of your SDK. To learn more about them, see SDK Tools in the developer guide.
SDK Platform-tools — Contains platform-dependent tools for developing and debugging your application. These tools support the latest features of the Android platform and are typically updated only when a new platform becomes available. You can access these tools in the <sdk>/platform-tools/ directory. To learn more about them, see Platform Tools in the developer guide.
Android platforms — An SDK platform is available for every production Android platform deployable to Android-powered devices. Each SDK platform component includes a fully compliant Android library, system image, sample code, and emulator skins. To learn more about a specific platform, see the list of platforms that appears under the section "Downloadable SDK Components" on the left part of this page.
USB Driver for Windows (Windows only) — Contains driver files that you can install on your Windows computer, so that you can run and debug your applications on an actual device. You do not need the USB driver unless you plan to debug your application on an actual Android-powered device. If you develop on Mac OS X or Linux, you do not need a special driver to debug your application on an Android-powered device. See Using Hardware Devices for more information about developing on a real device.
Samples — Contains the sample code and apps available for each Android development platform. If you are just getting started with Android development, make sure to download the samples to your SDK.
Documentation — Contains a local copy of the latest multiversion documentation for the Android framework API.
The Third party Add-ons provide components that allow you to create a development environment using
a specific Android external library (such as the Google Maps library) or a customized (but fully
compliant) Android system image. You can add additional Add-on repositories by clicking Add Add-on
Site .
Step 5. Exploring the SDK (Optional)
Once you've installed the SDK and downloaded the platforms, documentation, and add-ons that you need,
we suggest that you open the SDK directory
Android's Features
Handset layouts
The platform is adaptable to larger, VGA, 2D graphics library, 3D graphics library based on
OpenGL ES 2.0 specifications, and traditional smartphone layouts.
Storage
SQLite, a lightweight relational database, is used for data storage purposes.
Connectivity
Android supports connectivity technologies including GSM/EDGE, IDEN, CDMA, EV-DO,
UMTS, Bluetooth, Wi-Fi, LTE, NFC and WiMAX.
Messaging
SMS and MMS are available forms of messaging, including threaded text messaging and now
Android Cloud To Device Messaging (C2DM) is also a part of Android Push Messaging service.
Multiple language support
Android supports multiple languages.
Web browser
The web browser available in Android is based on the open-source WebKit layout engine,
coupled with Chrome's V8 JavaScript engine. The browser scores 100/100 on the Acid3 test on
Android 4.0.
Java support
While most Android applications are written in Java, there is no Java Virtual Machine in the
platform and Java byte code is not executed. Java classes are compiled into Dalvik executables
and run on Dalvik, a specialized virtual machine designed specifically for Android and optimized
for battery-powered mobile devices with limited memory and CPU. J2ME support can be
provided via third-party applications.
Media support
Android supports the following audio/video/still media formats: WebM, H.263, H.264 (in 3GP or
MP4 container), MPEG-4 SP, AMR, AMR-WB (in 3GP container), AAC, HE-AAC (in MP4 or
3GP container), MP3, MIDI, Ogg Vorbis, FLAC, WAV, JPEG, PNG, GIF, BMP.[71]
Streaming media support
RTP/RTSP streaming (3GPP PSS, ISMA), HTML progressive download (HTML5 <video> tag).
Adobe Flash Streaming (RTMP) and HTTP Dynamic Streaming are supported by the Flash
plugin. Apple HTTP Live Streaming is supported by RealPlayer for Android, and by the
operating system in Android 3.0 (Honeycomb).
Additional hardware support
Android can use video/still cameras, touchscreens, GPS, accelerometers, gyroscopes, barometers,
magnetometers, dedicated gaming controls, proximity and pressure sensors, thermometers,
accelerated 2D bit blits (with hardware orientation, scaling, pixel format conversion) and
accelerated 3D graphics.
Multi-touch
Android has native support for multi-touch which was initially made available in handsets such as
the HTC Hero. The feature was originally disabled at the kernel level (possibly to avoid
infringing Apple's patents on touch-screen technology at the time). Google has since released an
update for the Nexus One and the Motorola Droid which enables multi-touch natively.
Bluetooth
Supports A2DP, AVRCP, sending files (OPP), accessing the phone book (PBAP), voice dialing
and sending contacts between phones. Keyboard, mouse and joystick (HID) support is available
in Android 3.1+, and in earlier versions through manufacturer customizations and third-party
applications.
Video calling
Android does not support native video calling, but some handsets have a customized version of
the operating system that supports it, either via the UMTS network (like the Samsung Galaxy S)
or over IP. Video calling through Google Talk is available in Android 2.3.4 and later.
Gingerbread allows Nexus S to place Internet calls with a SIP account. This allows for enhanced
VoIP dialing to other SIP accounts and even phone numbers. Skype 2.1 offers video calling in
Android 2.3, including front camera support.
Multitasking
Multitasking of applications is available.
Voice based features
Google search through voice has been available since initial release. Voice actions for calling,
texting, navigation, etc. are supported on Android 2.2 onwards.
Tethering
Android supports tethering, which allows a phone to be used as a wireless/wired Wi-Fi hotspot.
Before Android 2.2 this was supported by third-party applications or manufacturer
customizations.
Screen capture
Android supports capturing a screenshot by pressing the power and volume-down buttons at the
same time. Prior to Android 4.0, the only methods of capturing a screenshot were through
manufacturer and third-party customizations or otherwise by using a PC connection (DDMS
developer's tool). These alternative methods are still available with the latest Android.
SYSTEM DESIGN
Unified Modeling Language:
The Unified Modeling Language allows the software engineer to express an analysis
model using the modeling notation that is governed by a set of syntactic semantic and pragmatic
rules.A UML system is represented using five different views that describe the system from
distinctly different perspective. Each view is defined by a set of diagram, which is as follows.
User Model View
i. This view represents the system from the users perspective.
ii. The analysis representation describes a usage scenario from the end-users
perspective.
Structural model view
i. In this model the data and functionality are arrived from inside the system.
ii. This model view models the static structures.
Behavioral Model View
It represents the dynamic of behavioral as parts of the system, depicting
the interactions of collection between various structural elements described in the
user model and structural model view.
Implementation Model View
In this the structural and behavioral as parts of the system are represented
as they are to be built.
Environmental Model View
In this the structural and behavioral aspects of the environment in which the
system is to be implemented are represented
UML is specifically constructed through two different domains they are:
UML Analysis modeling, this focuses on the user model and structural model views of
the system.UML design modeling, which focuses on the behavioral modeling, implementation
modeling and environmental model views
Use case Diagrams represent the functionality of the system from a user’s point of view. Use
cases are used during requirements elicitation and analysis to represent the functionality of the
system. Use cases focus on the behavior of the system from external point of view. Actors are
external entities that interact with the system. Examples of actors include users like
administrator, bank customer …etc., or another system like central database.
UML DIAGRAMS
Use case diagram:
A use case diagram in the unified modeling language is a type of behavioral
diagram defined by and created from a use-case analysis. Its purpose is to present a
graphical overview of a functionality provided by a system in terms of actors and
their goals and any dependencies between those use cases. The main purpose of
use case diagram is to show what system functions are performed for which actor.
Fig:1
Class diagram:
A class diagram in the unified modeling language is a type of static structured
diagram that describes the structure of a system by showing the systems classes,
their attributes, operations and their relationships among objects.
Fig:2
Activity diagram:
An activity diagram shows the flow from activity. An activity is an ongoing non
atomic execution within a state machine. Activities ultimately result in some
actions, which is made up of executable atomic computations. It can use these
diagrams to model the dynamic aspects.
Fig:3
Sequence diagram:
We have two types of interaction diagrams in UML. One is sequence diagram and the other is a
collaboration diagram A Sequence diagram is an interaction diagram that shows how objects
operate with one another and in what order. It is a construct of a message sequence chart.
A sequence diagram shows object interactions arranged in time sequence.
Fig:4
Collaboration diagram:
We have two types of interaction diagrams in UML. One is sequence diagram and the other is a
collaboration diagram. The sequence diagram captures the time sequence of message flow from
one object to another and the collaboration diagram describes the organization of objects in a
system taking part in the message flow.
Fig:5
Component diagram:
Component diagram is a special kind of diagram in UML. The purpose is also different from all
other diagrams discussed so far. It does not describe the functionality of the system but it
describes the components used to make those functionalities.
Fig:6
Deployment diagram:
Deployment diagram is a structure diagram which shows architecture of the system
as deployment (distribution) of software artifacts to deployment targets. Artifacts represent
concrete elements in the physical world that are the result of a development process.
Fig:7
CODING
Add deal activity
package fit.com.mlritcollegephonebook;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
public class AddDealActivity extends AppCompatActivity {
String email;
Button b1,b2;
EditText location,title,desc,oprice,dprice;
DatabaseHandler db;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_add_deal);
db = new DatabaseHandler(this);
b1 = (Button)findViewById(R.id.busbtn);
b2 = (Button)findViewById(R.id.bckt);
location = (EditText)findViewById(R.id.busno);
title = (EditText)findViewById(R.id.from);
desc = (EditText)findViewById(R.id.to);
oprice = (EditText)findViewById(R.id.time);
dprice = (EditText)findViewById(R.id.freq);
b2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent(getApplicationContext(),AdminProfileActivity.class);
startActivity(i);
}
});
b1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
deals d = new deals();
d.setBusno(location.getText().toString().toLowerCase()
d.setFrom(title.getText().toString());
d.setTo(desc.getText().toString());
d.setTime(oprice.getText().toString());
d.setFrequency(dprice.getText().toString()
if(db.addDeal(d))
{
Toast.makeText(getApplicationContext(),"User added
successfully",Toast.LENGTH_SHORT).show();
}
else
{
Toast.makeText(getApplicationContext(),"User not added
successfully",Toast.LENGTH_SHORT).show();
}
}
});
}
}
admin profile activity:
package fit.com.mlritcollegephonebook;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
public class AdminProfileActivity extends AppCompatActivity {
Button b1,b2,b3;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_admin_profile);
b1 = (Button)findViewById(R.id.adroute);
b2 = (Button)findViewById(R.id.cgpwd);
b3 = (Button) findViewById(R.id.logoutb);
b1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent(getApplicationContext(),AddDealActivity.class);
startActivity(i);
}
});
b2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent(getApplicationContext(),ChangePwd.class);
startActivity(i);
}
});
b3.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent(getApplicationContext(),LoginActivity.class);
startActivity(i);
}
});
}
}
change password:
package fit.com.mlritcollegephonebook;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
public class ChangePwd extends AppCompatActivity {
Button b;
EditText e1,e2;
DatabaseHandler db;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_change_pwd);
b = (Button)findViewById(R.id.cb);
e1 = (EditText)findViewById(R.id.u1);
e2 = (EditText)findViewById(R.id.p1);
db = new DatabaseHandler(this);
b.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Shopper s = new Shopper();
s.setUsername(e1.getText().toString());
s.setPassword(e2.getText().toString());
int n = db.updateAdmin(s);
if(n>0)
{
Toast.makeText(getApplicationContext(), "Password updated successfully",
Toast.LENGTH_SHORT).show();
Intent i = new Intent(getApplicationContext(),LoginActivity.class);
startActivity(i);
}
else
{
Toast.makeText(getApplicationContext(),"Password not updated
successfully",Toast.LENGTH_SHORT).show();
}
}
});
}
}
Customer:
package fit.com.mlritcollegephonebook;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.Toast;
import java.util.List;
public class Customer extends AppCompatActivity implements OnItemClickListener{
Button b2;
ListView lview;
ListViewAdapter lviewAdapter;
String dids[] = null;
DatabaseHandler db;
String titles[] = null;
String dprices[] = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_customer);
String type = getIntent().getStringExtra("type").toString();
b2 = (Button)findViewById(R.id.bb);
db = new DatabaseHandler(this);
b2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent(getApplicationContext(),MainActivity.class);
startActivity(i);
}
});
List<deals> dealset = db.getAllBuses(type);
// Toast.makeText(getApplicationContext(), location + dealset.size(),
Toast.LENGTH_SHORT).show();
if(dealset.size()>0) {
dids = new String[dealset.size()];
titles = new String[dealset.size()];
dprices = new String[dealset.size()];
// Toast.makeText(getApplicationContext(), location + dealset.size(),
Toast.LENGTH_SHORT).show();
int i = 0;
for (deals d : dealset) {
dids[i] = d.getTime();
titles[i] = d.getFrom();
dprices[i]=d.getTo();
i++;
}
lview = (ListView) findViewById(R.id.listView2);
lviewAdapter = new ListViewAdapter(this, dids, titles,dprices);
lview.setAdapter(lviewAdapter);
lview.setOnItemClickListener(this);
}
else
{
Toast.makeText(getApplicationContext(), "No Data Found",
Toast.LENGTH_SHORT).show();
}
}
public void onItemClick(AdapterView<?> arg0, View arg1, int position, long id) {
Toast.makeText(this,"Hello User", Toast.LENGTH_SHORT).show();
}
}
customer1:
package fit.com.mlritcollegephonebook;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.Toast;
import java.util.List;
public class Customer1 extends AppCompatActivity implements
OnItemClickListener,View.OnClickListener{
EditText e1;
Button b1,b2;
ListView lview;
ListViewAdapter lviewAdapter;
String dids[] = null;
DatabaseHandler db;
String titles[] = null;
String dprices[] = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_customer1);
e1 = (EditText)findViewById(R.id.l11);
b1 = (Button)findViewById(R.id.s11);
b2 = (Button)findViewById(R.id.bb1);
db = new DatabaseHandler(this);
b2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent(getApplicationContext(),MainActivity.class);
startActivity(i);
}
});
b1.setOnClickListener(this);
}
public void onItemClick(AdapterView<?> arg0, View arg1, int position, long id) {
Toast.makeText(this,"Hello", Toast.LENGTH_SHORT).show();
}
public void onClick(View v) {
String l1 = e1.getText().toString();
//Toast.makeText(getApplicationContext(),location,Toast.LENGTH_SHORT).show();
List<deals> dealset = db.getAllUsers(l1);
// Toast.makeText(getApplicationContext(), location + dealset.size(),
Toast.LENGTH_SHORT).show();
if(dealset.size()>0) {
dids = new String[dealset.size()];
titles = new String[dealset.size()];
dprices = new String[dealset.size()];
// Toast.makeText(getApplicationContext(), location + dealset.size(),
Toast.LENGTH_SHORT).show();
int i = 0;
for (deals d : dealset) {
dids[i] = d.getBusno();
titles[i] = d.getTime();
dprices[i]=d.getTo();
i++;
}
lview = (ListView) findViewById(R.id.listView2);
lviewAdapter = new ListViewAdapter(this, dids, titles,dprices);
lview.setAdapter(lviewAdapter);
lview.setOnItemClickListener(this);
}
else
{
Toast.makeText(getApplicationContext(), "No Data Found",
Toast.LENGTH_SHORT).show();
}
}
}
Databasehandler:
package fit.com.mlritcollegephonebook;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import java.util.ArrayList;
import java.util.List;
public class DatabaseHandler extends SQLiteOpenHelper {
// All Static variables
// Database Version
private static final int DATABASE_VERSION = 1;
// Database Name
private static final String DATABASE_NAME = "collegedb";
// Contacts table name
private static final String TABLE_ROUTE = "users";
private static final String TABLE_ADMIN = "admin";
// Contacts Table Columns names
private static final String KEY_RID = "uid";
private static final String KEY_BUSNO = "type";
private static final String KEY_FROM = "name";
private static final String KEY_TO = "moile";
private static final String KEY_TIME = "email";
private static final String KEY_FREQ = "stream";
private static final String KEY_AID = "aid";
private static final String KEY_USERNAME = "username";
private static final String KEY_PASSWORD = "password";
public DatabaseHandler(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
// Creating Tables
@Override
public void onCreate(SQLiteDatabase db) {
String CREATE_DEALS_TABLE = "CREATE TABLE " + TABLE_ROUTE + "("
+ KEY_RID + " INTEGER PRIMARY KEY," + KEY_BUSNO + " TEXT,"
+ KEY_FROM + " TEXT," + KEY_TO + " TEXT,"+ KEY_TIME + " TEXT,"
+ KEY_FREQ + " TEXT" + ")";
String CREATE_SHOPPER_TABLE = "CREATE TABLE " + TABLE_ADMIN + "("
+ KEY_AID + " INTEGER PRIMARY KEY," + KEY_USERNAME + " TEXT,"
+ KEY_PASSWORD + " TEXT" + ")";
db.execSQL(CREATE_DEALS_TABLE);
db.execSQL(CREATE_SHOPPER_TABLE);
}
// Upgrading database
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
// Drop older table if existed
db.execSQL("DROP TABLE IF EXISTS " + TABLE_ROUTE);
db.execSQL("DROP TABLE IF EXISTS " + TABLE_ADMIN);
// Create tables again
onCreate(db);
}
/**
* All CRUD(Create, Read, Update, Delete) Operations
*/
// Adding new contact
void addAdmin() {
SQLiteDatabase db = this.getWritableDatabase();
ContentValues values = new ContentValues();
values.put(KEY_USERNAME, "admin");
values.put(KEY_PASSWORD, "admin");
// Inserting Row
db.insert(TABLE_ADMIN, null, values);
db.close(); // Closing database connection
}
boolean addDeal(deals deal) {
SQLiteDatabase db = this.getWritableDatabase();
ContentValues values = new ContentValues();
values.put(KEY_BUSNO,deal.getBusno() );
values.put(KEY_FROM,deal.getFrom() );
values.put(KEY_TO, deal.getTo());
values.put(KEY_TIME,deal.getTime());
values.put(KEY_FREQ,deal.getFrequency() );
// Inserting Row
db.insert(TABLE_ROUTE, null, values);
db.close(); // Closing database connection
return true;
}
// Getting All Contacts
public List<deals> getAllBuses(String typeu) {
List<deals> dealsList = new ArrayList<deals>();
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.query(TABLE_ROUTE, new String[]{KEY_RID,
KEY_BUSNO, KEY_FROM,KEY_TO,KEY_TIME,KEY_FREQ},
KEY_BUSNO + "=?",
new String[]{typeu}, null, null, null, null);
// looping through all rows and adding to list
if (cursor.moveToFirst()) {
do {
deals deal = new deals();
deal.setRid((Integer.parseInt(cursor.getString(0))));
deal.setBusno(cursor.getString(1));
deal.setFrom(cursor.getString(2));
deal.setTo(cursor.getString(3));
deal.setTime(cursor.getString(4));
deal.setFrequency(cursor.getString(5));
// Adding contact to list
dealsList.add(deal);
} while (cursor.moveToNext());
}
// return contact list
return dealsList;
}
public List<deals> getAllUsers(String name) {
List<deals> dealsList = new ArrayList<deals>();
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.query(TABLE_ROUTE, new String[]{KEY_RID,
KEY_BUSNO, KEY_FROM,KEY_TO,KEY_TIME,KEY_FREQ}, KEY_FROM
+ "=?",
new String[]{name}, null, null, null, null);
// looping through all rows and adding to list
if (cursor.moveToFirst()) {
do {
deals deal = new deals();
deal.setRid((Integer.parseInt(cursor.getString(0))));
deal.setBusno(cursor.getString(1));
deal.setFrom(cursor.getString(2));
deal.setTo(cursor.getString(3));
deal.setTime(cursor.getString(4));
deal.setFrequency(cursor.getString(5));
// Adding contact to list
dealsList.add(deal);
} while (cursor.moveToNext());
}
// return contact list
return dealsList;
}
public String[] getAllUsers() {
String selectQuery = "SELECT * FROM " + TABLE_ADMIN;
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery(selectQuery, null);
String users[] = new String[cursor.getCount()];
int i=0;
// looping through all rows and adding to list
if (cursor.moveToFirst()) {
do {
String str = cursor.getString(1)+":"+cursor.getString(2);
users[i]=str;
i++;
} while (cursor.moveToNext());
}
// return contact list
return users;
}
public int updateAdmin(Shopper contact) {
SQLiteDatabase db = this.getWritableDatabase();
ContentValues values = new ContentValues();
values.put(KEY_PASSWORD, contact.getPassword());
// updating row
return db.update(TABLE_ADMIN, values, KEY_USERNAME + " = ?",
new String[] { contact.getUsername() });
}
}
Listviewadapter:
package fit.com.mlritcollegephonebook;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.TextView;
public class ListViewAdapter extends BaseAdapter
{
Activity context;
String title[];
String description[];
String dprices[];
String mobile;
int mob;
public ListViewAdapter(Activity context, String[] title, String[] description,String[] dprices) {
super();
this.context = context;
this.title = title;
this.description = description;
this.dprices = dprices;
}
public int getCount() {
// TODO Auto-generated method stub
return title.length;
}
public Object getItem(int position) {
// TODO Auto-generated method stub
return null;
}
public long getItemId(int position) {
// TODO Auto-generated method stub
return 0;
}
private class ViewHolder {
TextView txtViewTitle;
TextView txtViewDescription;
TextView dpriceview;
Button b1;
}
public View getView(int position, View convertView, ViewGroup parent)
{
// TODO Auto-generated method stub
ViewHolder holder;
this.mob=position;
LayoutInflater inflater = context.getLayoutInflater();
if (convertView == null)
{
convertView = inflater.inflate(R.layout.listitem_row, null);
holder = new ViewHolder();
holder.txtViewTitle = (TextView) convertView.findViewById(R.id.textView1);
holder.txtViewDescription = (TextView) convertView.findViewById(R.id.textView2);
holder.dpriceview = (TextView) convertView.findViewById(R.id.textView3);
holder.b1 = (Button)convertView.findViewById(R.id.callp);
convertView.setTag(holder);
}
else
{
holder = (ViewHolder) convertView.getTag();
}
holder.txtViewTitle.setText(description[position]);
holder.txtViewDescription.setText(dprices[position]);
holder.dpriceview.setText(title[position]);
holder.b1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent callIntent = new Intent(Intent.ACTION_CALL);
callIntent.setData(Uri.parse("tel:" + dprices[mob]));
context.startActivity(callIntent);
}
});
return convertView;
}
}
Loginactivity:
package fit.com.mlritcollegephonebook;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.annotation.TargetApi;
import android.app.LoaderManager.LoaderCallbacks;
import android.content.CursorLoader;
import android.content.Intent;
import android.content.Loader;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.provider.ContactsContract;
import android.support.annotation.NonNull;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.inputmethod.EditorInfo;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import java.util.ArrayList;
import java.util.List;
import static android.Manifest.permission.READ_CONTACTS;
/**
* A login screen that offers login via email/password.
*/
public class LoginActivity extends AppCompatActivity implements LoaderCallbacks<Cursor> {
/**
* Id to identity READ_CONTACTS permission request.
*/
private static final int REQUEST_READ_CONTACTS = 0;
/**
* A dummy authentication store containing known user names and passwords.
* TODO: remove after connecting to a real authentication system.
*/
String[] DUMMY_CREDENTIALS = null;
/**
* Keep track of the login task to ensure we can cancel it if requested.
*/
private UserLoginTask mAuthTask = null;
// UI references.
private AutoCompleteTextView mEmailView;
private EditText mPasswordView;
private View mProgressView;
private View mLoginFormView;
Button b;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
// Set up the login form.
mEmailView = (AutoCompleteTextView) findViewById(R.id.email);
populateAutoComplete();
DatabaseHandler db = new DatabaseHandler(this);
db.addAdmin();
DUMMY_CREDENTIALS = db.getAllUsers();
b = (Button)findViewById(R.id.logout_l2);
b.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent(getApplicationContext(),MainActivity.class);
startActivity(i);
}
});
mPasswordView = (EditText) findViewById(R.id.password);
mPasswordView.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView textView, int id, KeyEvent keyEvent) {
if (id == R.id.login || id == EditorInfo.IME_NULL) {
attemptLogin();
return true;
}
return false;
}
});
Button mEmailSignInButton = (Button) findViewById(R.id.email_sign_in_button);
mEmailSignInButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
attemptLogin();
}
});
mLoginFormView = findViewById(R.id.login_form);
mProgressView = findViewById(R.id.login_progress);
}
private void populateAutoComplete() {
if (!mayRequestContacts()) {
return;
}
getLoaderManager().initLoader(0, null, this);
}
private boolean mayRequestContacts() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
return true;
}
if (checkSelfPermission(READ_CONTACTS) ==
PackageManager.PERMISSION_GRANTED) {
return true;
}
if (shouldShowRequestPermissionRationale(READ_CONTACTS)) {
Snackbar.make(mEmailView, R.string.permission_rationale,
Snackbar.LENGTH_INDEFINITE)
.setAction(android.R.string.ok, new OnClickListener() {
@Override
@TargetApi(Build.VERSION_CODES.M)
public void onClick(View v) {
requestPermissions(new String[]{READ_CONTACTS},
REQUEST_READ_CONTACTS);
}
});
} else {
requestPermissions(new String[]{READ_CONTACTS},
REQUEST_READ_CONTACTS);
}
return false;
}
/**
* Callback received when a permissions request has been completed.
*/
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,
@NonNull int[] grantResults) {
if (requestCode == REQUEST_READ_CONTACTS) {
if (grantResults.length == 1 && grantResults[0] ==
PackageManager.PERMISSION_GRANTED) {
populateAutoComplete();
}
}
}
/**
* Attempts to sign in or register the account specified by the login form.
* If there are form errors (invalid email, missing fields, etc.), the
* errors are presented and no actual login attempt is made.
*/
private void attemptLogin() {
if (mAuthTask != null) {
return;
}
// Reset errors.
mEmailView.setError(null);
mPasswordView.setError(null);
// Store values at the time of the login attempt.
String email = mEmailView.getText().toString();
String password = mPasswordView.getText().toString();
boolean cancel = false;
View focusView = null;
// Check for a valid password, if the user entered one.
if (TextUtils.isEmpty(password)) {
mPasswordView.setError("Password is required");
focusView = mPasswordView;
cancel = true;
}
// Check for a valid email address.
if (TextUtils.isEmpty(email)) {
mEmailView.setError(getString(R.string.error_field_required));
focusView = mEmailView;
cancel = true;
}
if (cancel) {
// There was an error; don't attempt login and focus the first
// form field with an error.
focusView.requestFocus();
} else {
// Show a progress spinner, and kick off a background task to
// perform the user login attempt.
showProgress(true);
mAuthTask = new UserLoginTask(email, password);
mAuthTask.execute((Void) null);
}
}
private boolean isEmailValid(String email) {
//TODO: Replace this with your own logic
return email.contains("@");
}
private boolean isPasswordValid(String password) {
//TODO: Replace this with your own logic
return password.length() > 4;
}
/**
* Shows the progress UI and hides the login form.
*/
@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2)
private void showProgress(final boolean show) {
// On Honeycomb MR2 we have the ViewPropertyAnimator APIs, which allow
// for very easy animations. If available, use these APIs to fade-in
// the progress spinner.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) {
int shortAnimTime =
getResources().getInteger(android.R.integer.config_shortAnimTime);
mLoginFormView.setVisibility(show ? View.GONE : View.VISIBLE);
mLoginFormView.animate().setDuration(shortAnimTime).alpha(
show ? 0 : 1).setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
mLoginFormView.setVisibility(show ? View.GONE : View.VISIBLE);
}
});
mProgressView.setVisibility(show ? View.VISIBLE : View.GONE);
mProgressView.animate().setDuration(shortAnimTime).alpha(
show ? 1 : 0).setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
mProgressView.setVisibility(show ? View.VISIBLE : View.GONE);
}
});
} else {
// The ViewPropertyAnimator APIs are not available, so simply show
// and hide the relevant UI components.
mProgressView.setVisibility(show ? View.VISIBLE : View.GONE);
mLoginFormView.setVisibility(show ? View.GONE : View.VISIBLE);
}
}
@Override
public Loader<Cursor> onCreateLoader(int i, Bundle bundle) {
return new CursorLoader(this,
// Retrieve data rows for the device user's 'profile' contact.
Uri.withAppendedPath(ContactsContract.Profile.CONTENT_URI,
ContactsContract.Contacts.Data.CONTENT_DIRECTORY),
ProfileQuery.PROJECTION,
// Select only email addresses.
ContactsContract.Contacts.Data.MIMETYPE +
" = ?", new String[]{ContactsContract.CommonDataKinds.Email
.CONTENT_ITEM_TYPE},
// Show primary email addresses first. Note that there won't be
// a primary email address if the user hasn't specified one.
ContactsContract.Contacts.Data.IS_PRIMARY + " DESC");
}
@Override
public void onLoadFinished(Loader<Cursor> cursorLoader, Cursor cursor) {
List<String> emails = new ArrayList<>();
cursor.moveToFirst();
while (!cursor.isAfterLast()) {
emails.add(cursor.getString(ProfileQuery.ADDRESS));
cursor.moveToNext();
}
addEmailsToAutoComplete(emails);
}
@Override
public void onLoaderReset(Loader<Cursor> cursorLoader) {
}
private void addEmailsToAutoComplete(List<String> emailAddressCollection) {
//Create adapter to tell the AutoCompleteTextView what to show in its dropdown list.
ArrayAdapter<String> adapter =
new ArrayAdapter<>(LoginActivity.this,
android.R.layout.simple_dropdown_item_1line, emailAddressCollection);
mEmailView.setAdapter(adapter);
}
private interface ProfileQuery {
String[] PROJECTION = {
ContactsContract.CommonDataKinds.Email.ADDRESS,
ContactsContract.CommonDataKinds.Email.IS_PRIMARY,
};
int ADDRESS = 0;
int IS_PRIMARY = 1;
}
/**
* Represents an asynchronous login/registration task used to authenticate
* the user.
*/
public class UserLoginTask extends AsyncTask<Void, Void, Boolean> {
private final String mEmail;
private final String mPassword;
UserLoginTask(String email, String password) {
mEmail = email;
mPassword = password;
}
@Override
protected Boolean doInBackground(Void... params) {
// TODO: attempt authentication against a network service.
boolean flag = false;
try {
// Simulate network access.
Thread.sleep(2000);
} catch (InterruptedException e) {
return false;
}
for (String credential : DUMMY_CREDENTIALS) {
String[] pieces = credential.split(":");
if (pieces[0].equals(mEmail) && pieces[1].equals(mPassword)) {
flag= true;
break;
}
}
return flag;
}
@Override
protected void onPostExecute(final Boolean success) {
mAuthTask = null;
showProgress(false);
if (success) {
Intent i = new Intent(getApplicationContext(),AdminProfileActivity.class);
startActivity(i);
} else {
Toast.makeText(getApplicationContext(), "Wrong credentials",
Toast.LENGTH_SHORT).show();
mEmailView.requestFocus();
}
}
@Override
protected void onCancelled() {
mAuthTask = null;
showProgress(false);
}
}
}
main activity:
package fit.com.mlritcollegephonebook;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
public class MainActivity extends AppCompatActivity {
Button b1,b2,b3,b4;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
b1 = (Button)findViewById(R.id.user);
b2 = (Button)findViewById(R.id.admin);
b3 = (Button)findViewById(R.id.fac);
b4 = (Button)findViewById(R.id.src1);
b1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent(getApplicationContext(),Customer.class);
i.putExtra("type","student");
startActivity(i);
}
});
b2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent(getApplicationContext(),LoginActivity.class);
startActivity(i);
}
});
b3.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent(getApplicationContext(),Customer.class);
i.putExtra("type","faculty");
startActivity(i);
}
});
b4.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent(getApplicationContext(),Customer1.class);
startActivity(i);
}
});
}
}
Shopper:
package fit.com.mlritcollegephonebook;
public class Shopper {
int aid;
String username,password;
public int getAid() {
return aid;
}
public void setAid(int aid) {
this.aid = aid;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}
splash screen:
package fit.com.mlritcollegephonebook;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import androiwd.support.v7.app.AppCompatActivity;
public class SplashScreen extends AppCompatActivity {
// Splash screen timer
private static int SPLASH_TIME_OUT = 3000;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash_screen);
new Handler().postDelayed(new Runnable() {
/*
* Showing splash screen with a timer. This will be useful when you
* want to show case your app logo / company
*/
@Override
public void run() {
// This method will be executed once the timer is over
// Start your app main activity
Intent i = new Intent(SplashScreen.this, MainActivity.class);
startActivity(i);
// close this activity
finish();
}
}, SPLASH_TIME_OUT);
}
}
application test:
package fit.com.mlritcollegephonebook;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
}
example unit test:
package fit.com.mlritcollegephonebook;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* To work on unit tests, switch the Test Artifact in the Build Variants view.
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
}
public String getFrequency() {
return frequency;
}
public void setFrequency(String frequency) {
this.frequency = frequency;
}
public int getRid() {
return rid;
}
public void setRid(int rid) {
this.rid = rid;
}
}
SYSTEM TESTING:
The purpose of testing is to discover errors. Testing is the process of trying to discover every
conceivable fault or weakness in a work product. It provides a way to check the functionality of
components, sub assemblies, assemblies and/or a finished product It is the process of exercising
software with the intent of ensuring that the
Software system meets its requirements and user expectations and does not fail in an
unacceptable manner. There are various types of test. Each test type addresses a specific testing
requirement.
TYPES OF TESTS:
Unit testing
Unit testing involves the design of test cases that validate that the internal program logic is
functioning properly, and that program inputs produce valid outputs. All decision branches and
internal code flow should be validated. It is the testing of individual software units of the
application .it is done after the completion of an individual unit before integration. This is a
structural testing, that relies on knowledge of its construction and is invasive. Unit tests perform
basic tests at component level and test a specific business process, application, and/or system
configuration. Unit tests ensure that each unique path of a business process performs accurately
to the documented specifications and contains clearly defined inputs and expected results.
Integration testing:
Integration tests are designed to test integrated software components to determine if they
actually run as one program. Testing is event driven and is more concerned with the basic
outcome of screens or fields. Integration tests demonstrate that although the components were
individually satisfaction, as shown by successfully unit testing, the combination of components is
correct and consistent. Integration testing is specifically aimed at exposing the problems that
arise from the combination of components.
Functional test:
Functional tests provide systematic demonstrations that functions tested are available as
specified by the business and technical requirements, system documentation, and user manuals.
Functional testing is centered on the following items:
Valid Input : identified classes of valid input must be accepted.
Invalid Input : identified classes of invalid input must be rejected.
Functions : identified functions must be exercised.
Output : identified classes of application outputs must be exercised.
Systems/Procedures: interfacing systems or procedures must be invoked.
Organization and preparation of functional tests is focused on requirements, key functions, or
special test cases. In addition, systematic coverage pertaining to identify Business process flows;
data fields, predefined processes, and successive processes must be considered for testing.
Before functional testing is complete, additional tests are identified and the effective value of
current tests is determined.
System Test:
System testing ensures that the entire integrated software system meets requirements. It tests a
configuration to ensure known and predictable results. An example of system testing is the
configuration oriented system integration test. System testing is based on process descriptions
and flows, emphasizing pre-driven process links and integration points.
White Box Testing:
White Box Testing is a testing in which in which the software tester has knowledge of the
inner workings, structure and language of the software, or at least its purpose. It is purpose. It is
used to test areas that cannot be reached from a black box level.
Black Box Testing:
Black Box Testing is testing the software without any knowledge of the inner workings,
structure or language of the module being tested. Black box tests, as most other kinds of tests,
must be written from a definitive source document, such as specification or requirements
document, such as specification or requirements document. It is a testing in which the software
under test is treated, as a black box .you cannot “see” into it. The test provides inputs and
responds to outputs without considering how the software works.
Acceptance Testing:
User Acceptance Testing is a critical phase of any project and requires significant participation
by the end user. It also ensures that the system meets the functional requirements.
Test Results: All the test cases mentioned above passed successfully. No defects encountered.
SCREEN SHOTS
Fig:1
The above fig consists of four fields i.e Admin, Students, Faculties and search
Fig:2
After clicking on Admin field it goes to another page where admin can login by using username and password
Fig:3
After login it goes to another page where Admin can add student and faculty
Limitations and Future Enhancement
Limitations of the system:.
System works in all platforms and its compatible environments.
Advanced techniques are not used to check the authorization.
No online
Future Enhancements:
It is not possible to develop a system that makes all the requirements of the user. User
requirements keep changing as the system is being used. Some of the future enhancements that
can be done to this system are:
As the technology emerges, it is possible to upgrade the system and can be online.
Because it is based on object-oriented design, any further changes can be easily
adaptable.
Based on the future security issues, security can be improved using emerging
technologies.
GPS can be added
CONCLUSION
This application software has been computed successfully and was also tested successfully
by taking “test cases”. It is user friendly, and has required options, which can be utilized by the
user to perform the desired operations.
The software is developed using as front end and SQLite as back end in Windows
environment. The goals that are achieved by the software are:
Optimum utilization of resources.
Efficient management of records.
Simplification of the operations.
Less processing time and getting required information.
User friendly.
Portable and flexible for further enhancement.
BIBILIOGRAPHY
References Made From:
Beginning Android 4 Application Development by Wei-Meng Lee
Beginning Android By Mark Murphy
Professional Android 2 Application Development by Reto Meier(Wrox)
Introducing Android Development with Ice Cream Sandwich by Shane Conder, Lauren Darcey
Sams Teach Yourself Java in 24 Hours (Covering Java 7 and Android) By Rogers Cadenhead
Programming Android By Zigurd Mednieks, Laird Dornin, G. Blake Meike, Masumi Nakamura
Amazing Android Apps For Dummies by Daniel A.Begun
Developing Android Applications with Flex 4.5 By Rich Tretola
Sites Referred:
http://developer.android.com/guide/index.html
http://www.codeproject.com/Articles/102065/Android-A-beginner-s-guide
http://mobile.dzone.com/articles/fundamentals-android-tutorial
http://mobile.tutsplus.com/tutorials/android/java-tutorial/