Blood Finder Application

Download as pdf or txt
Download as pdf or txt
You are on page 1of 96

A

PROJECT REPORT
ON
BLOOD FINDER APPLICATION
UNDER THE PARTIAL FULFILMENT OF UNIVERSITY OF
MUMBAI REQUIREMENT FOR THE COURSE OF
TYBSC (COMPUTER SCIENCE)
-: SUBMITTED BY :-

MR. MUSTAFA MAZHAR RAMPURAWALA


-: GUIDED BY :-

Prof. Rajesh Yadav

DEPARTMENT OF COMPUTER SCIENCE


V.K.K MENON COLLEGE OF COMMERCE AND ECONOMICS
&
SHARAD SHANKAR DIGHE COLLEGE OF SCIENCE
BHANDUP (EAST), MUMBAI-400-042
UNIVERSITY OF MUMBAI
2018-19

1
INDEX

Sr.no. Title Page No.


01 Acknowledgement 3
02 Overview
2.1 Abstract 4
2.2 Undertaking 5
2.3 Objective 6
2.4 Introduction 7

2.5 Requirement Specification 9

2.6 Feasibility Study 12

03 System Design
3.1 E-R Diagram 14

3.2 Class Diagram 15

3.3 Use Case Diagram 16

3.4 System Flow Chart 18

3.5 Data Flow Diagram 19

04 Code Implementation 21

05 Results
5.1 Tables 87

5.2 Screen Shots 88

06 Future Scope 95

07 Reference and Bibliography 96

2
ACKNOWLEDGEMENT

It gives great pleasure and pride as I presented my project on “BLOOD FINDER

APPLICATION”. This acknowledgement is a small effort to express and our

gratitude to all those who have shown me the path to bring out the various colours

of this project with their vast treasure of experience and knowledge.

I would like to express my sincere thanks to Prof. Mr. Rajesh Yadav and Dr. Mrs.

Saloni Bhushan, who helped me throughout the project for providing me moral

support, conductive work environment and the much needed inspiration to

conclude this project on time.

I also take this opportunity to thank Head of the Department Dr. Mrs. Saloni

Bhushan and thanks to all of our professors of the Department of Computer

Science of V.K.Krishna Menon College for giving me an opportunity to implement

and get complete my project with their most needful suggestions and guidance.

Prof. Mr. Rajesh Yadav has provided me with the guidance and necessary support

during each phase of the project. He was the Source of continuous encouragement

as each milestone was crossed.

Last but not the least, I would like to thank my friends and family for the support

and encouragement they given me during this course of work.

3
ABSTRACT

Blood Finder is an emergency time app where a user can search for the blood banks as

well as the registered blood donors around Mumbai. This application also provide an

opportunity for the user of this application to become a registered donor for this user have

to enroll for the donor request from the application itself. If the admin wish to make user

a registered donor, with some of the formalities with the organization it can be done.

Specialization of this application is that the user will not have to register on sign-in for

searching the blood banks and blood donors it can be just done by installing the

application to the mobile.

The purpose of making this application is to save the user’s time for searching blood of

needed blood group during the time of the emergency.

This is an android application developed in Java and XML with the connectivity of

SQLite database. This application will provide most of basic functionality required for an

emergency time application. All the details of Blood banks and Blood donors are stored

in the database i.e. SQLite.

This application allowed the user to get all the information regarding blood banks and

blood donors such as Name, Number, Address, Blood Group, rather than searching it on

the different websites and wasting the precious time. This application is effective and

user friendly.

4
UNDERTAKING

This is to declare that the project entitled “BLOOD FINDER

APPLICATION” is an original work done by the undersigned, in partial

fulfilment of the requirement for the degree “Bachelor of Science in

Computer Science” at CS Department, V.K.Krishna Menon College.

All the analysis design and System developed have been accomplished by the

undersigned. Moreover, this project has not been submitted to any other College or

University.

Mr. Mustafa Mazhar Rampurawala

5
OBJECTIVE

 Blood is one of the main need for the human body to live on the earth

 BLOOD FINDER is the application to find the blood at the time of need by the

user

 The main objective of the project is to design and develop a user-friendly

emergency application.

 Easy to use and efficient application

 To develop a platform to search for blood without wasting the users precious time

 The user can search for the particular blood group in the application using the

search operation

 To save the user’s time there is no login or signup is required, User can directly

install the application and search for the desired need

 A user can also request to enroll for a blood donor to the admin of the application

 The search option is provided according to the blood group in the application

itself, The user does not have to enter any thing in the application manually

 Hospitals can also use this application to search the blood for the patient

 The databases for the blood banks and blood groups are been separated due to the

security purpose

6
INTRODUCTION

This project acts as an important role in saving life of human beings and which is

also its main aim. The project Android Blood finder application is developed so

that users can view the information about registered blood donors such as name,

address, and contact along with their details of blood group.

The project also has a enroll page where in, the user can Enroll i.e. request the

admin to being a donor. Thus, this application helps to select the right donor

instantly using the blood group.

The main aim of developing this application is to reduce the time to a great extent

that is spent in searching for the right donor and the availability of blood required.

Thus, this application provides the required information in no time and also helps

in quicker decision making.

Advantages :-

 This system can be used to view all the donor details and accordingly select

the right donor.

 This system can also be used to view nearby blood banks in very quick time

 The android mobile user will be able to make quick decision in selecting a

donor.

7
 Usage of this application will greatly reduce time in selecting the right

donor.

 This application can be used by any common people.

 The application can prove very beneficial into the clinics, hospitals as the

requirement is very high in such places.

Disadvantages :-

 The android mobile user will not be able to insert or view details if the

server goes down. Thus, there is disadvantage of single point failure.

 This app cannot be run on any other Platform rather than Android i.e.

(Apple, Blackberry)

 This application only provides blood bank information of the Mumbai

Suburban’s

 The application cannot be run on the API less than 15 i.e. (Jellybean)

8
REQUIREMENT SPECIFICATION

A Software Requirement Specification (SRS) is a description of a software system to be

developed. It lays out functional and non-functional requirements, and may include a set

of use cases that describe the user interactions that the software must provide.

SOFTWARE REQUIREMNTS :-

Front End :- ANDROID STUDIO (JAVA & XML)

Back End :- SQLite Database

Development Tool :- Android Development Toolkit (ADT)

HARDWARE REQUIREMENTS :-

Processor :- Intel i5/AMD

Hard Disk :- 5 GB

RAM :- 8 GB

ANDROID DEVICE

FUNCTIONAL REQUIREMENT :-

ADMIN :-

Login : The Admin can Login by providing Username & Password.

Management : The Admin Manages this 3 Information’s

9
1. Blood Banks in Mumbai :-

Admin can ADD, UPDATE, DELETE the Blood Bank’s Database as required.

2. Blood Donor’s :-

Admin can ADD, UPDATE, DELETE the Blood Donor’s Database as required.

3. Enroll Request’s for Donor’s :-

Admin can check for the Request of User’s to be a Donor & add them in the

Donor’s list.

Logout : The Admin can Logout using this Option & redirect to the Main Page of the

Application

USER :-

Search Blood Banks in Mumbai : The User can Search the Blood banks in Mumbai

& contact them or go there for the Requirement of the Blood to the User.

Search Donor’s: The User can Search for the Blood Donor’s nearest to it as of its

Requirements of Blood Group & contact the person for the blood donation.

Enroll to be a Donor : The User can enroll the request for being the donor to the

Admin.

10
NON-FUNCTIONAL REQUIREMENT:-

Performance Requirements :

Performance is measured in terms of the output provided by the application. Requirement

specification plays an important part in the analysis of the system, which will fit into

required environment. It rests largely with the users of the system to give the requirement

specifications because they are the people who finally use the system. This is because the

requirements have to be known during the initial stage so that the system can be designed

according to those requirements. It is Very difficult to change the system once it has been

designed and on the other hand designing a system, which does not cater to the

requirements of the user, is of no use. The requirement Specification for any system can

be broadly stated as given below :

 The system should be interface with the user

 The system should be accurate

Reliability

 In this system reliability means the

Security

 The Database should be protected from hacking, virus etc.

Availability

 This application will be available always

11
FEASIBLITY STUDY

Feasibility study includes consideration of all the possible way to provide solution to the

given problem. The proposed solution should satisfy all the user requirements and should

be flexible enough so that future changes can be easily done based on the future

requirements.

OPERATIONAL FEASIBILTY

Operation of the proposed system depend on the user. These various user type are

mentioned below :

1. Admin

2. User

Admin :-

 Admin can manage the Enrollment of the user.

 If the user preform an unusual or illegal kind of task then the admin may wish to

delete the account of that particular user.

 Admin can provide necessary information related to the application such as new

updates.

 Admin can add new Blood Banks in the Application while Updating the data

12
User :-

 User can Search for the Blood donor’s & blood banks on basis of its requirements

 User can Updates related to the application is provided by the admin to the user.

 User can Enroll the Request form to the Admin for being a Donor

TECHNICAL FEASIBLITY

 The blood finder application is created by using certain programming languages

like JAVA & XML, and SQLite as a database.

 JAVA is used for front-end and XML for data transfer.

 This system avoids manual work such as maintaining a hard copy of Blood

Donor’s list.

 This application keeps the data in a centralized way which is available to all the

user

ECONOMICAL FEASIBLITY

 As no papers required so it reduce cost.

 It would be beneficial because only one time development efforts required.

All people are aware of technologies so no special skills required to run the
system

13
SYSTEM DESIGN

E-R DIAGRAM :-

14
CLASS DIAGRAM :-

Admin
+admin_username:String
+admin_password :String
+AddDonor()
+EditDonor()
+DeleteDonor()
+AddBloodBank()
+EditBloodBank()
+DeleteBloodBank()
+EnrollUser()

Blood Bank User Blood Donor

+bnk_id : Int +user_id : Int +bld_dnr_id :Int

+bnk_name : String +user_name : String +bld_dnr_name : String

+bnk_address : String +user_address : String +bld_dnr_address : String

+bnk_contact : Int +user_contact : String +bld_dnr_contact : Int

+show_bnk_data() +user_blood_group : String +bld_dnr_blood_group : String


+show_blood_bank() +show_bld_dnr_data()
+show_blood_donor()
+enroll_as_donor()

15
USE CASE DIAGRAM :-

ADMIN

Search Blood Donor

Search Blood Bank

Enroll User
request for donor

16
USER

Enroll the user


request

Add Blood Bank

Delete Blood Bank

Edit Blood Bank

Delete Blood Donor


Add Blood Donor

Edit Blood Donor

17
SYSTEM FLOW CHART
Start

No
Is Admin Is User

No
Yes

Login

Yes
Admin Is Valid

Manage Search
Blood Bank Donor’s

Manage Search
Blood Donor Blood Banks

Manage User Enroll to be a


Enroll Request Donor

Logout

Exit

18
DATA FLOW DIAGRAM

ADMIN :-

Admin

Login to
System

Manage
Modules

Manage Blood Manage Blood Manage Users


Banks Details Donors Details Enroll Request

19
USER :-

Search
User
Modules

Enroll to be
a Donor

Search Blood Search Blood

Banks Details Donors Details

20
CODE :-
AndroidMainifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.mustafa.found">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="BLOOD FINDER"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />


</intent-filter>
</activity>
<activity android:name=".user_p" />
<activity android:name=".admin_p" />
<activity android:name=".admin_log" />
<activity android:name=".add_bank" />
<activity android:name=".edit_bank" />
<activity android:name=".del_bank" />
<activity android:name=".admin_sel" />
<activity android:name=".add_dnr" />
<activity android:name=".del_dnr" />
<activity android:name=".edit_dnr" />
<activity android:name=".admin_dnr_p"></activity>
</application>
</manifest>

MainActivity.java

package com.example.mustafa.found;
import android.content.DialogInterface;
import android.content.Intent;
import android.support.v7.app.AlertDialog;

21
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageButton;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
ImageButton i,i1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
i=(ImageButton)findViewById(R.id.i_admin);
i1=(ImageButton)findViewById(R.id.i_user);
i.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(getApplicationContext(),"Please provide your
Authentication",Toast.LENGTH_SHORT).show();
startActivity(new Intent(MainActivity.this,admin_log.class));
}
});
i1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(getApplicationContext(),"Welcome
User",Toast.LENGTH_SHORT).show();
startActivity(new Intent(MainActivity.this,user_p.class));
}
});
}
@Override
public void onBackPressed() {
new AlertDialog.Builder(this)
.setMessage("Are you sure you want to exit?")
.setCancelable(false)
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
MainActivity.this.finish();
}
})

22
.setNegativeButton("No", null)
.show();
}
}

user_p.java

package com.example.mustafa.found;
import android.content.Intent;
import android.database.Cursor;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
public class user_p extends AppCompatActivity {
Button b1,b2;
MyHelper mh;
MyHelperdnr mhdnr;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_user_p);
mh=new MyHelper(this);
mhdnr=new MyHelperdnr(this);
b1=(Button)findViewById(R.id.b_bnk);
b2=(Button)findViewById(R.id.b_dnr);
viewAllData();
viewAllDatadnr();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater m=getMenuInflater();
m.inflate(R.menu.usermenu,menu);
return super.onCreateOptionsMenu(menu);

23
}
@Override
public boolean onOptionsItemSelected(MenuItem item)
{
switch (item.getItemId())
{
case R.id.it_enrl:
startActivity(new Intent(user_p.this,Enroll_donor.class));
Toast.makeText(getApplicationContext(),"Enroll Yourself as
Donor",Toast.LENGTH_SHORT).show();
break;
case R.id.it_about:
startActivity(new Intent(user_p.this,aboutus.class));
Toast.makeText(getApplicationContext(),"About
Us",Toast.LENGTH_SHORT).show();
break;
}
return super.onOptionsItemSelected(item);
}
public void viewAllData()
{
b1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Cursor res = mh.getAllData();
if(res.getCount() == 0)
{
showMessage("Error","Nothing Found");
return;
}
StringBuffer buffer = new StringBuffer();
while(res.moveToNext())
{
buffer.append("Name : " + res.getString(1) + "\n");
buffer.append("Address : " + res.getString(2) + "\n");
buffer.append("Mobile Number: " + res.getString(3) + "\n");
}
showMessage("Blood Bank Data", buffer.toString());
}
});

24
}

public void viewAllDatadnr()


{
b2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Toast.makeText(getApplicationContext(),"Blood donors
List",Toast.LENGTH_SHORT).show();
startActivity(new Intent(user_p.this,search.class));
}
});
}
public void showMessage(String title , String message)
{
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setCancelable(true);
builder.setTitle(title);
builder.setMessage(message);
builder.show();
}
}

admin_log.java

package com.example.mustafa.found;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
public class admin_log extends AppCompatActivity {
EditText t1,t2;
Button b;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_admin_log);

25
t1=(EditText)findViewById(R.id.txt_username);
t2=(EditText)findViewById(R.id.txt_pass);
b=(Button)findViewById(R.id.btn_log);
b.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String unm,pass;
unm=t1.getText().toString();
pass=t2.getText().toString();
if(unm.isEmpty())
{
t1.setError("Enter Username");
return;
}
if(pass.isEmpty())
{
t2.setError("Enter Password");
return;
}
if(unm.isEmpty())
{
t1.setError("Enter Username");
}
if(pass.isEmpty())
{
t2.setError("Enter Password");
}
if(unm.equals("admin") && pass.equals("admin"))
{
Toast.makeText(getApplicationContext(),"Welcome
Admin",Toast.LENGTH_SHORT).show();
startActivity(new Intent(admin_log.this,admin_sel.class));
}
else
{
Toast.makeText(getApplicationContext(),"Please Enter Correct
Credentials",Toast.LENGTH_SHORT).show();
}
} });
}}

26
admin_sel.java

package com.example.mustafa.found;
import android.content.DialogInterface;
import android.content.Intent;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
public class admin_sel extends AppCompatActivity {
Button bt1,bt2;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_admin_sel);
bt1=(Button)findViewById(R.id.b_bank_admin);
bt2=(Button)findViewById(R.id.b_dnr_admin);
bt1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(getApplicationContext(),"Blood Bank
details",Toast.LENGTH_SHORT).show();
startActivity(new Intent(admin_sel.this,admin_p.class));
}
});
bt2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(getApplicationContext(),"Blood Donor
details",Toast.LENGTH_SHORT).show();
startActivity(new Intent(admin_sel.this,admin_dnr_p.class));
}
});

27
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater m=getMenuInflater();
m.inflate(R.menu.adminlogout,menu);
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item)
{
switch (item.getItemId())
{
case R.id.logout:
new AlertDialog.Builder(this)
.setMessage("Do you want to Exit")
.setCancelable(false)
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
startActivity(new Intent(admin_sel.this,MainActivity.class));
}
})
.setNegativeButton("No",null)
.show();
break;
}
return super.onOptionsItemSelected(item);
}
}

admin_p.java

package com.example.mustafa.found;
import android.content.Intent;
import android.database.Cursor;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Menu;

28
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.ImageButton;
import android.widget.Toast;
public class admin_p extends AppCompatActivity {
ImageButton btnadd,btnedit,btndel,btnshw;
MyHelper mh;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_admin_p);
btnadd=(ImageButton)findViewById(R.id.b_add);
btnedit=(ImageButton)findViewById(R.id.b_edit);
btndel=(ImageButton)findViewById(R.id.b_del);
btnshw=(ImageButton)findViewById(R.id.b_shhw);
mh=new MyHelper(this);
viewAll();
btnadd.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(admin_p.this,add_bank.class));
Toast.makeText(getApplicationContext(),"Add bank
details",Toast.LENGTH_SHORT).show();
}
});
btnedit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(admin_p.this,edit_bank.class));
Toast.makeText(getApplicationContext(),"Edit Bank
Details",Toast.LENGTH_SHORT).show();
}
});
btndel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(admin_p.this,del_bank.class));
Toast.makeText(getApplicationContext(),"Delete Bank
Details",Toast.LENGTH_SHORT).show();

29
}
});
}
public void viewAll()
{
btnshw.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Cursor res = mh.getAllData();
if(res.getCount() == 0)
{
// show msg
showMessage("Error","Nothing Found");
return;
}
StringBuffer buffer = new StringBuffer();
while(res.moveToNext())
{
buffer.append("Id : " + res.getString(0) + "\n");
buffer.append("Name : " + res.getString(1) + "\n");
buffer.append("Address : " + res.getString(2) + "\n");
buffer.append("Mobile Number : " + res.getString(3) + "\n");
}
showMessage("Blood Bank Data", buffer.toString());
}
});

}
public void showMessage(String title , String message)
{
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setCancelable(true);
builder.setTitle(title);
builder.setMessage(message);
builder.show();
}
}

30
add_bank.java

package com.example.mustafa.found;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
public class add_bank extends AppCompatActivity {
MyHelper mh;
EditText bnm,badd,bmob;
Button btnadd;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_add_bank);
mh=new MyHelper(this);
bnm=(EditText)findViewById(R.id.txt_name);
badd=(EditText)findViewById(R.id.txt_address);
bmob=(EditText)findViewById(R.id.txt_mob);
btnadd=(Button)findViewById(R.id.add_btn);
addData();
}
public void addData()
{
btnadd.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View view) {
String s1,s2,s3;
s1=bnm.getText().toString();
s2=badd.getText().toString();
s3=bmob.getText().toString();
if(s1.isEmpty())
{
bnm.setError("Enter Name");
return;
}

31
if(s2.isEmpty())
{
badd.setError("Enter Address");
return;
}
if(s3.isEmpty())
{
bmob.setError("Enter Mobile Number");
return;
}
if(bmob.length()<10)
{
if(bmob.length()>8 || bmob.length()<8)
{
bmob.setError("Enter 8 digit Phone Number");
return;
}
}
if(bmob.length()>8)
{
if(bmob.length()<10 || bmob.length()>10)
{
bmob.setError("Enter 10 digit Mobile Number");
return;
}
}
boolean isInserted = mh.insertData(bnm.getText().toString() ,
badd.getText().toString(),
bmob.getText().toString());
if(isInserted == true)
Toast.makeText(add_bank.this,"Bank Data Inserted
Successfully",Toast.LENGTH_SHORT).show();
else
Toast.makeText(add_bank.this, "Bank Data not Inserted Succesfully"
,Toast.LENGTH_SHORT).show();
}
});
}
}

32
edit_bank.java

package com.example.mustafa.found;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
public class edit_bank extends AppCompatActivity {
MyHelper mh;
EditText et1,et2,et3,et4;
Button btnedit;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_edit_bank);
mh=new MyHelper(this);
et1=(EditText)findViewById(R.id.id_edit);
et2=(EditText)findViewById(R.id.nm_edit);
et3=(EditText)findViewById(R.id.add_edit);
et4=(EditText)findViewById(R.id.mob_edit);
btnedit=(Button)findViewById(R.id.edit_btn);
updateData();
}
public void updateData()
{
btnedit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view)
{
String r1,r2,r3,r4;
r1=et1.getText().toString();
r2=et2.getText().toString();
r3=et3.getText().toString();
r4=et4.getText().toString();
if(r1.isEmpty())
{
et1.setError("Enter ID");

33
return;
}
if(r2.isEmpty())
{
et2.setError("Enter Name");
}
if(r3.isEmpty())
{
et3.setError("Enter Address");
return;
}
if(r4.isEmpty())
{
et4.setError("Enter Mobile Number");
return;
}
boolean isUpdate =
mh.updateData(et1.getText().toString(),et2.getText().toString(),et3.getText().toString(),et4.getT
ext().toString());
if(isUpdate== true)
Toast.makeText(edit_bank.this,"Blood Bank Data Updated
Successfully",Toast.LENGTH_SHORT).show();

else
Toast.makeText(edit_bank.this, "Blood Bank Data Not Updated Successfully"
,Toast.LENGTH_SHORT).show();
}
});
}
}

del_bank.java

package com.example.mustafa.found;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

34
import android.widget.EditText;
import android.widget.Toast;
public class del_bank extends AppCompatActivity {
EditText delt;
Button bdl;
MyHelper mh;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_del_bank);
delt=(EditText)findViewById(R.id.txt_id);
bdl=(Button)findViewById(R.id.del_btn);
mh=new MyHelper(this);
delData();
}
public void delData()
{
bdl.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String d1=delt.getText().toString();
if(d1.isEmpty())
{
delt.setError("Enter ID");
return;
}
boolean isdelete=mh.delData(delt.getText().toString());
if(isdelete==true)
Toast.makeText(getApplicationContext(),"Blood Bank Data Deleted
Successfully",Toast.LENGTH_SHORT).show();
else
Toast.makeText(getApplicationContext(),"Blood Bank Data Not Deleted
Successfully",Toast.LENGTH_SHORT).show();
}
});
}
}

35
admin_dnr_p.java

package com.example.mustafa.found;
import android.content.DialogInterface;
import android.content.Intent;
import android.database.Cursor;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.ImageButton;
import android.widget.Toast;
public class admin_dnr_p extends AppCompatActivity {
ImageButton dnradd,dnredit,dnrdel,dnrshw;
MyHelperdnr mhdnr;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_admin_dnr_p);
dnradd=(ImageButton)findViewById(R.id.d_add);
dnredit=(ImageButton)findViewById(R.id.d_edit);
dnrdel=(ImageButton)findViewById(R.id.d_del);
dnrshw=(ImageButton)findViewById(R.id.d_shhw);
mhdnr=new MyHelperdnr(this);
viewAlldnr();
dnradd.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(admin_dnr_p.this,add_dnr.class));
}
});
dnredit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(admin_dnr_p.this,edit_dnr.class));
}
});

36
dnrdel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(admin_dnr_p.this,del_dnr.class));
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater m=getMenuInflater();
m.inflate(R.menu.adminmenu,menu);
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item)
{
switch (item.getItemId())
{
case R.id.ad_it_nw_req:
startActivity(new Intent(admin_dnr_p.this,new_donor_request.class));
Toast.makeText(getApplicationContext(),"Enroll Donor's
Request",Toast.LENGTH_SHORT).show();
break;

}
return super.onOptionsItemSelected(item);
}
public void viewAlldnr()
{
dnrshw.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Cursor res = mhdnr.getAllDatadnr();
if(res.getCount() == 0)
{
// show msg
showMessage("Error","Nothing Found");
return;
}

37
StringBuffer buffer = new StringBuffer();
while(res.moveToNext())
{
buffer.append("Id : " + res.getString(0) + "\n");
buffer.append("Name : " + res.getString(1) + "\n");
buffer.append("Address : " + res.getString(2) + "\n");
buffer.append("Mobile Number : " + res.getString(3) + "\n");
buffer.append("Blood Group : "+res.getString(4)+ "\n");
}
showMessage("Blood Donor Data", buffer.toString());
}
});

}
public void showMessage(String title , String message)
{
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setCancelable(true);
builder.setTitle(title);
builder.setMessage(message);
builder.show();
}
}

add_dnr.java

package com.example.mustafa.found;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

public class add_dnr extends AppCompatActivity {


EditText dd1,dd2,dd3,dd4;
Button dbnadd;

38
MyHelperdnr mhdnr;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_add_dnr);
dd1=(EditText)findViewById(R.id.txt_nm_dnr);
dd2=(EditText)findViewById(R.id.txt_add_dnr);
dd3=(EditText)findViewById(R.id.txt_mob_dnr);
dd4=(EditText)findViewById(R.id.txt_bld_dnr);
dbnadd=(Button)findViewById(R.id.btn_add_dnr);
mhdnr=new MyHelperdnr(this);
addDatadnr();
}

public void addDatadnr()


{
dbnadd.setOnClickListener(new View.OnClickListener()
{

@Override
public void onClick(View view) {
String a1,a2,a3,a4;
a1=dd1.getText().toString();
a2=dd2.getText().toString();
a3=dd3.getText().toString();
a4=dd4.getText().toString();
if(a1.isEmpty())
{
dd1.setError("Enter Name");
return;
}
if(a2.isEmpty())
{
dd2.setError("Enter Address");
return;
}
if(a3.isEmpty())
{
dd3.setError("Enter Mobile Number");
return;

39
}
if(dd3.length()>10 || dd3.length()<10)
{
dd3.setError("Enter 10 digit Mobile Number");
return;
}
if(a4.isEmpty())
{
dd4.setError("Enter Blood group");
return;
}
boolean isInserted = mhdnr.insertDatadnr(dd1.getText().toString() ,
dd2.getText().toString(),
dd3.getText().toString(), dd4.getText().toString());
if(isInserted == true)
Toast.makeText(add_dnr.this,"Blood Donor Data Inserted
Successfully",Toast.LENGTH_SHORT).show();

else
Toast.makeText(add_dnr.this, "Blood Donor Data Not Inserted Successfully"
,Toast.LENGTH_SHORT).show();
}
});

}
}

edit_dnr.java

package com.example.mustafa.found;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

40
public class edit_dnr extends AppCompatActivity {
EditText edn1,edn2,edn3,edn4,edn5;
Button dnredit;
MyHelperdnr mhdnr;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_edit_dnr);
edn1=(EditText)findViewById(R.id.id_edit_dnr);
edn2=(EditText)findViewById(R.id.nm_edit_dnr);
edn3=(EditText)findViewById(R.id.add_edit_dnr);
edn4=(EditText)findViewById(R.id.mob_edit_dnr);
edn5=(EditText)findViewById(R.id.bld_edit_dnr);
dnredit=(Button)findViewById(R.id.btn_edit_dnr);
mhdnr=new MyHelperdnr(this);
updateDatadnr();
}

public void updateDatadnr()


{

dnredit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view)
{
String z1,z2,z3,z4,z5;
z1=edn1.getText().toString();
z2=edn2.getText().toString();
z3=edn3.getText().toString();
z4=edn4.getText().toString();
z5=edn5.getText().toString();
if(z1.isEmpty())
{
edn1.setError("Enter ID");
return;
}
if(z2.isEmpty())
{
edn2.setError("Enter Name");
return;

41
}
if(z3.isEmpty())
{
edn3.setError("Enter Address");
return;
}
if(z4.isEmpty())
{
edn4.setError("Enter Mobile Number");
return;
}
if(z5.isEmpty())
{
edn5.setError("Enter Blood Group");
return;
}
boolean isUpdate =
mhdnr.updateDatadnr(edn1.getText().toString(),edn2.getText().toString(),edn3.getText().toStri
ng(),edn4.getText().toString(),edn5.getText().toString());
if(isUpdate== true)
Toast.makeText(edit_dnr.this,"Blood Donor Data Updated
Successfully",Toast.LENGTH_SHORT).show();

else
Toast.makeText(edit_dnr.this, "Blood Donor Data Not Updated Successfully"
,Toast.LENGTH_SHORT).show();
}
});
}
}

del_dnr.java

package com.example.mustafa.found;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;

42
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

public class del_dnr extends AppCompatActivity {


EditText eid;
Button btndl;
MyHelperdnr mhdnr;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_del_dnr);
eid=(EditText)findViewById(R.id.id_del_dnr);
btndl=(Button)findViewById(R.id.btn_del_dnr);
mhdnr=new MyHelperdnr(this);
delDatadnr();
}
public void delDatadnr()
{
btndl.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String d2=eid.getText().toString();
if(d2.isEmpty())
{
eid.setError("Enter ID");
return;
}
boolean isdelete=mhdnr.delDatadnr(eid.getText().toString());
if(isdelete==true)
Toast.makeText(getApplicationContext(),"Blood Donor Data Deleted
Successfully",Toast.LENGTH_SHORT).show();
else
Toast.makeText(getApplicationContext(),"Blood Donor Data Not
Deleted",Toast.LENGTH_SHORT).show();
}
});
}
}

43
new_donor_request.java

package com.example.mustafa.found;

import android.content.Intent;
import android.database.Cursor;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageButton;
import android.widget.Toast;

public class new_donor_request extends AppCompatActivity {


ImageButton l1,l2;
MyHelperenrdnr enrdnr;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_new_donor_request);
l1=(ImageButton)findViewById(R.id.ib_shw_new);
l2=(ImageButton)findViewById(R.id.ib_del_new);
l2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(new_donor_request.this,del_dnr_req.class));
Toast.makeText(getApplicationContext(),"Delete Donor
reuest",Toast.LENGTH_SHORT).show();
}
});
enrdnr=new MyHelperenrdnr(this);
showdataenrdnr();
}
public void showdataenrdnr()
{
l1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Toast.makeText(getApplicationContext(),"Blood Donors

44
Request",Toast.LENGTH_SHORT).show();
Cursor res = enrdnr.getAllDataenrdnr();
if(res.getCount() == 0)
{
showMessage("Error","Nothing Found");
return;
}
StringBuffer buffer = new StringBuffer();
while(res.moveToNext())
{
buffer.append("ID : "+res.getString(0) + "\n");
buffer.append("Name : " + res.getString(1) + "\n");
buffer.append("Address : " + res.getString(2) + "\n");
buffer.append("Mobile Number: " + res.getString(3) + "\n");
}
showMessage("Blood Donor's Request", buffer.toString());
}
});
}
public void showMessage(String title , String message)
{
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setCancelable(true);
builder.setTitle(title);
builder.setMessage(message);
builder.show();
}
}

del_dnr_req.java

package com.example.mustafa.found;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

45
import android.widget.Toast;

public class del_dnr_req extends AppCompatActivity {


EditText delreq1;
Button delreqbtn;
MyHelperenrdnr enrdnr;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_del_dnr_req);
delreq1=(EditText)findViewById(R.id.txt_del_req);
delreqbtn=(Button)findViewById(R.id.btn_del_req);
enrdnr=new MyHelperenrdnr(this);
delenrdnr();
}
public void delenrdnr()
{
delreqbtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String d2=delreq1.getText().toString();
if(d2.isEmpty())
{
delreq1.setError("Enter ID");
return;
}
boolean isdelete=enrdnr.delDataenrdnr(delreq1.getText().toString());
if(isdelete==true)
Toast.makeText(getApplicationContext(),"Blood Donor Data Deleted
Successfully",Toast.LENGTH_SHORT).show();
else
Toast.makeText(getApplicationContext(),"Blood Donor Data Not
Deleted",Toast.LENGTH_SHORT).show();
}
});
}
}

46
Enroll_donor.java

package com.example.mustafa.found;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

public class Enroll_donor extends AppCompatActivity {


EditText nw1,nw2,nw3,nw4;
Button nwadd;
MyHelperenrdnr enrdnr;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_enroll_donor);
nw1=(EditText)findViewById(R.id.txt_new_nm);
nw2=(EditText)findViewById(R.id.txt_new_add);
nw3=(EditText)findViewById(R.id.txt_new_mob);
nw4=(EditText)findViewById(R.id.txt_new_bld);
nwadd=(Button)findViewById(R.id.btn_new_add);
enrdnr=new MyHelperenrdnr(this);
addDataenrdnr();
}
public void addDataenrdnr()
{
nwadd.setOnClickListener(new View.OnClickListener()
{

@Override
public void onClick(View view) {
String a1,a2,a3,a4;
a1=nw1.getText().toString();
a2=nw2.getText().toString();
a3=nw3.getText().toString();
a4=nw4.getText().toString();
if(a1.isEmpty())

47
{
nw1.setError("Enter Name");
return;
}
if(a2.isEmpty())
{
nw2.setError("Enter Address");
return;
}
if(a3.isEmpty())
{
nw3.setError("Enter Mobile Number");
return;
}
if(nw3.length()>10 || nw3.length()<10)
{
nw3.setError("Enter 10 digit Mobile Number");
return;
}
if(a4.isEmpty())
{
nw4.setError("Enter Blood group");
return;
}
boolean isInserted = enrdnr.insertDataenrdnr(nw1.getText().toString() ,
nw2.getText().toString(),
nw3.getText().toString(), nw4.getText().toString());
if(isInserted == true)
Toast.makeText(Enroll_donor.this,"Your Enrollment is Done
Successfully",Toast.LENGTH_SHORT).show();

else
Toast.makeText(Enroll_donor.this, "Your Enrolllment is not done Successfully"
,Toast.LENGTH_SHORT).show();
}
});

48
search_bld_grp.java

package com.example.mustafa.found;
import android.database.Cursor;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class search_bld_grp extends AppCompatActivity {


MyHelperdnr mhdnr;
TextView ba,bap,bb,bbp,babp,bop;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_search);
mhdnr=new MyHelperdnr(this);
ba=(TextView)findViewById(R.id.txt_A);
bap=(TextView)findViewById(R.id.txt_AP);
bb=(TextView)findViewById(R.id.txt_B);
bbp=(TextView)findViewById(R.id.txt_BP);
babp=(TextView)findViewById(R.id.txt_ABP);
bop=(TextView)findViewById(R.id.txt_OP);
srchdataA();
srchdataAP();
srchdataB();
srchdataBP();
srchdataABP();
srchdataOP();
}
public void srchdataA()
{
ba.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Cursor cursor=mhdnr.srchdataA();
if(cursor.getCount() == 0)

49
{
// show msg
showMessage("Error","Nothing Found");
return;
}
StringBuffer buffer = new StringBuffer();
while(cursor.moveToNext())
{
buffer.append("Name : " + cursor.getString(1) + "\n");
buffer.append("Address : " + cursor.getString(2) + "\n");
buffer.append("Mobile Number : " + cursor.getString(3) + "\n");
buffer.append("Blood Group : "+cursor.getString(4)+ "\n");
}
showMessage(" Blood Group A Donor's List", buffer.toString());
}
});
}
public void srchdataAP()
{
bap.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Cursor cursor=mhdnr.srchdataAP();
if(cursor.getCount() == 0)
{
// show msg
showMessage("Error","Nothing Found");
return;
}
StringBuffer buffer = new StringBuffer();
while(cursor.moveToNext())
{
buffer.append("Name : " + cursor.getString(1) + "\n");
buffer.append("Address : " + cursor.getString(2) + "\n");
buffer.append("Mobile Number : " + cursor.getString(3) + "\n");
buffer.append("Blood Group : "+cursor.getString(4)+ "\n");
}
showMessage(" Blood Group A+ Donor's List", buffer.toString());
}
});

50
}
public void srchdataB()
{
bb.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Cursor cursor=mhdnr.srchdataB();
if(cursor.getCount() == 0)
{
// show msg
showMessage("Error","Nothing Found");
return;
}
StringBuffer buffer = new StringBuffer();
while(cursor.moveToNext())
{
buffer.append("Name : " + cursor.getString(1) + "\n");
buffer.append("Address : " + cursor.getString(2) + "\n");
buffer.append("Mobile Number : " + cursor.getString(3) + "\n");
buffer.append("Blood Group : "+cursor.getString(4)+ "\n");
}
showMessage(" Blood Group B Donor's List", buffer.toString());
}
});
}
public void srchdataBP()
{
bbp.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Cursor cursor=mhdnr.srchdataBP();
if(cursor.getCount() == 0)
{
// show msg
showMessage("Error","Nothing Found");
return;
}
StringBuffer buffer = new StringBuffer();
while(cursor.moveToNext())
{

51
buffer.append("Name : " + cursor.getString(1) + "\n");
buffer.append("Address : " + cursor.getString(2) + "\n");
buffer.append("Mobile Number : " + cursor.getString(3) + "\n");
buffer.append("Blood Group : "+cursor.getString(4)+ "\n");
}
showMessage(" Blood Group B+ Donor's List", buffer.toString());
}
});
}
public void srchdataABP()
{
babp.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Cursor cursor=mhdnr.srchdataABP();
if(cursor.getCount() == 0)
{
// show msg
showMessage("Error","Nothing Found");
return;
}
StringBuffer buffer = new StringBuffer();
while(cursor.moveToNext())
{
buffer.append("Name : " + cursor.getString(1) + "\n");
buffer.append("Address : " + cursor.getString(2) + "\n");
buffer.append("Mobile Number : " + cursor.getString(3) + "\n");
buffer.append("Blood Group : "+cursor.getString(4)+ "\n");
}
showMessage(" Blood Group AB+ Donor's List", buffer.toString());
}
});
}
public void srchdataOP()
{
bop.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Cursor cursor=mhdnr.srchdataOP();
if(cursor.getCount() == 0)

52
{
// show msg
showMessage("Error","Nothing Found");
return;
}
StringBuffer buffer = new StringBuffer();
while(cursor.moveToNext())
{
buffer.append("Name : " + cursor.getString(1) + "\n");
buffer.append("Address : " + cursor.getString(2) + "\n");
buffer.append("Mobile Number : " + cursor.getString(3) + "\n");
buffer.append("Blood Group : "+cursor.getString(4)+ "\n");
}
showMessage(" Blood Group O+ Donor's List", buffer.toString());
}
});
}

public void showMessage(String title , String message)


{
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setCancelable(true);
builder.setTitle(title);
builder.setMessage(message);
builder.show();
}
}

/---------------------------------- Helper class for Blood bank database----------------------------------/

MyHelper.java

package com.example.mustafa.found;

import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;

53
import android.database.sqlite.SQLiteOpenHelper;

public class MyHelper extends SQLiteOpenHelper {


public static final String DATABASE_NAME= "Bank.db";
public static final String TABLE_NAME = "bank_table";
public static final String COL_1 = "ID";
public static final String COl_2 = "Name";
public static final String COL_3 = "Address";
public static final String COL_4 = "Mobile";
public MyHelper(Context context)
{
super(context,DATABASE_NAME, null, 1);
}

@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL("Create Table " + TABLE_NAME + " (ID INTEGER PRIMARY KEY
AUTOINCREMENT , NAME TEXT, ADDRESS TEXT, MOBILE INTEGER) ");
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
}

public boolean insertData(String name, String address, String mobile)


{
SQLiteDatabase db = this.getWritableDatabase();
ContentValues contentValues = new ContentValues();
contentValues.put(COl_2,name);
contentValues.put(COL_3,address);
contentValues.put(COL_4,mobile);
long result = db.insert(TABLE_NAME,null,contentValues);
if (result == -1)
return false;
else
return true;
}
public Cursor getAllData()
{
SQLiteDatabase db = this.getWritableDatabase();
Cursor res = db.rawQuery("select * from " + TABLE_NAME,null);

54
return res;
}
public boolean updateData(String id,String name, String address, String mobile)
{
SQLiteDatabase db = this.getWritableDatabase();
ContentValues contentValues = new ContentValues();
contentValues.put(COl_2,name);
contentValues.put(COL_3,address);
contentValues.put(COL_4,mobile);
db.update(TABLE_NAME,contentValues,"ID = ?", new String[] {id});
return true;
}
public boolean delData(String id)
{
SQLiteDatabase db=this.getWritableDatabase();
db.delete(TABLE_NAME,"ID=?",new String[] {id});
return true;
}

/---------------------------- Helper class for Blood donor’s database------------------------------------/

MyHelperdnr.java

package com.example.mustafa.found;

import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class MyHelperdnr extends SQLiteOpenHelper {

public static final String DATABASE_NAME= "Blooddnr.db";


public static final String TABLE_NAME = "donor_table";
public static final String COL_1 = "ID";
public static final String COl_2 = "Name";

55
public static final String COL_3 = "Address";
public static final String COL_4 = "Mobile";
public static final String COL_5 = "Blood";
public MyHelperdnr(Context context)
{
super(context,DATABASE_NAME, null, 1);
}
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL("Create Table " + TABLE_NAME + " (ID INTEGER PRIMARY KEY
AUTOINCREMENT , NAME TEXT, ADDRESS TEXT, MOBILE INTEGER ,BLOOD
TEXT) ");
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
}
public boolean insertDatadnr(String name, String address, String mobile, String blood)
{
SQLiteDatabase db = this.getWritableDatabase();
ContentValues contentValues = new ContentValues();
contentValues.put(COl_2,name);
contentValues.put(COL_3,address);
contentValues.put(COL_4,mobile);
contentValues.put(COL_5,blood);
long result = db.insert(TABLE_NAME,null,contentValues);
if (result == -1)
return false;
else
return true;
}
public Cursor getAllDatadnr()
{
SQLiteDatabase db = this.getWritableDatabase();
Cursor res = db.rawQuery("select * from " + TABLE_NAME,null);
return res;
}
public boolean updateDatadnr(String id, String name, String address, String mobile, String
blood)
{
SQLiteDatabase db = this.getWritableDatabase();

56
ContentValues contentValues = new ContentValues();
contentValues.put(COl_2,name);
contentValues.put(COL_3,address);
contentValues.put(COL_4,mobile);
contentValues.put(COL_5,blood);
db.update(TABLE_NAME,contentValues,"ID = ?", new String[] {id});
return true;
}
public boolean delDatadnr(String id)
{
SQLiteDatabase db=this.getWritableDatabase();
db.delete(TABLE_NAME,"ID=?",new String[] {id});
return true;
}
public Cursor srchdataA()
{
SQLiteDatabase db=this.getReadableDatabase();
String blooda="A";
Cursor cursora=db.rawQuery("SELECT * FROM "+TABLE_NAME+" WHERE
"+COL_5 + " ='"+blooda+"'",null);
return cursora;
}
public Cursor srchdataAP()
{
SQLiteDatabase db=this.getReadableDatabase();
String bloodap="A+";
Cursor cursorap=db.rawQuery("SELECT * FROM "+TABLE_NAME+" WHERE
"+COL_5 + " ='"+bloodap+"'",null);
return cursorap;
}
public Cursor srchdataB()
{
SQLiteDatabase db=this.getReadableDatabase();
String bloodb="B";
Cursor cursorb=db.rawQuery("SELECT * FROM "+TABLE_NAME+" WHERE
"+COL_5 + " ='"+bloodb+"'",null);
return cursorb;
}
public Cursor srchdataBP()
{

57
SQLiteDatabase db=this.getReadableDatabase();
String bloodbp="B+";
Cursor cursorbp=db.rawQuery("SELECT * FROM "+TABLE_NAME+" WHERE
"+COL_5 + " ='"+bloodbp+"'",null);
return cursorbp;
}
public Cursor srchdataABP()
{
SQLiteDatabase db=this.getReadableDatabase();
String bloodabp="AB+";
Cursor cursorabp=db.rawQuery("SELECT * FROM "+TABLE_NAME+" WHERE
"+COL_5 + " ='"+bloodabp+"'",null);
return cursorabp;
}
public Cursor srchdataOP()
{
SQLiteDatabase db=this.getReadableDatabase();
String bloodop="O+";
Cursor cursorop=db.rawQuery("SELECT * FROM "+TABLE_NAME+" WHERE
"+COL_5 + " ='"+bloodop+"'",null);
return cursorop;
}
}

/---------------------------- Helper class for User Enroll request database-------------------------------/

MyHelperenrdnr.java

package com.example.mustafa.found;

import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class MyHelperenrdnr extends SQLiteOpenHelper {


public static final String DATABASE_NAME= "Bloodenrdnr.db";
public static final String TABLE_NAME = "donor_table";

58
public static final String COL_1 = "ID";
public static final String COl_2 = "Name";
public static final String COL_3 = "Address";
public static final String COL_4 = "Mobile";
public static final String COL_5 = "Blood";
public MyHelperenrdnr(Context context)
{
super(context,DATABASE_NAME, null, 1);
}
public void onCreate(SQLiteDatabase db) {
db.execSQL("Create Table " + TABLE_NAME + " (ID INTEGER PRIMARY KEY
AUTOINCREMENT , NAME TEXT, ADDRESS TEXT, MOBILE INTEGER ,BLOOD
TEXT) ");
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
}
public boolean insertDataenrdnr(String name, String address, String mobile, String blood)
{
SQLiteDatabase db = this.getWritableDatabase();
ContentValues contentValues = new ContentValues();
contentValues.put(COl_2,name);
contentValues.put(COL_3,address);
contentValues.put(COL_4,mobile);
contentValues.put(COL_5,blood);
long result = db.insert(TABLE_NAME,null,contentValues);
if (result == -1)
return false;
else
return true;
}
public Cursor getAllDataenrdnr()
{
SQLiteDatabase db = this.getWritableDatabase();
Cursor res = db.rawQuery("select * from " + TABLE_NAME,null);
return res;
}
public boolean delDataenrdnr(String id)
{
SQLiteDatabase db=this.getWritableDatabase();

59
db.delete(TABLE_NAME,"ID=?",new String[] {id});
return true;
}
}

Folder :- res (resource)


Package Name :- Layout

Activity_main.xml

<?xml version="1.0" encoding="utf-8"?>


<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
android:background="@drawable/a1">

<ImageButton
android:id="@+id/i_admin"
android:layout_width="137dp"
android:layout_height="139dp"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginStart="124dp"
android:layout_marginLeft="124dp"
android:layout_marginTop="61dp"
android:scaleType="fitCenter"
app:srcCompat="@drawable/admin" />

<ImageButton
android:id="@+id/i_user"
android:layout_width="142dp"
android:layout_height="142dp"
android:layout_alignLeft="@id/i_admin"
android:layout_alignStart="@+id/i_admin"

60
android:layout_alignParentBottom="true"
android:layout_marginStart="1dp"
android:layout_marginLeft="1dp"
android:layout_marginBottom="110dp"
android:scaleType="fitCenter"
app:srcCompat="@drawable/user" />

</RelativeLayout>

Activity_user_p.xml

<?xml version="1.0" encoding="utf-8"?>


<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".user_p"
android:background="@drawable/a1">

<Button
android:id="@+id/b_dnr"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"
android:layout_marginBottom="100dp"
android:layout_weight="1"
android:height="80dp"
android:background="@color/colorAccent"
android:text="Blood Donor" />

<Button
android:id="@+id/b_bnk"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_marginTop="150dp"

61
android:layout_weight="1"
android:height="80dp"
android:background="@color/colorAccent"
android:text="Blood Bank" />
</RelativeLayout>

Activity_add_bank.xml

<?xml version="1.0" encoding="utf-8"?>


<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".add_bank"
android:background="@drawable/a1">

<EditText
android:id="@+id/txt_name"
style="@android:style/Widget.Holo.EditText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginStart="5dp"
android:layout_marginLeft="5dp"
android:layout_marginTop="47dp"
android:ems="10"
android:hint="Name"
android:inputType="textPersonName"
android:textAppearance="@style/TextAppearance.AppCompat.Display1" />

<EditText
android:id="@+id/txt_address"
style="@android:style/Widget.Holo.EditText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"

62
android:layout_alignParentTop="true"
android:layout_marginStart="0dp"
android:layout_marginLeft="0dp"
android:layout_marginTop="162dp"
android:ems="10"
android:hint="Address"
android:inputType="textPersonName"
android:textAppearance="@style/TextAppearance.AppCompat.Display1" />

<EditText
android:id="@+id/txt_mob"
style="@android:style/Widget.Holo.EditText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentBottom="true"
android:layout_marginStart="0dp"
android:layout_marginBottom="153dp"
android:ems="10"
android:hint="Mobile"
android:inputType="number"
android:textAppearance="@style/TextAppearance.AppCompat.Display1"
android:layout_alignParentLeft="true"
android:layout_marginLeft="0dp" />

<Button
android:id="@+id/add_btn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"
android:layout_marginBottom="26dp"
android:height="80dp"
android:background="@color/colorAccent"
android:text="Add" />
</RelativeLayout>

63
Activity_add_dnr.xml

<?xml version="1.0" encoding="utf-8"?>


<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".add_dnr"
android:background="@drawable/a1">

<EditText
android:id="@+id/txt_nm_dnr"
style="@android:style/Widget.Holo.EditText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginStart="0dp"
android:layout_marginTop="1dp"
android:ems="10"
android:hint="Name"
android:inputType="textPersonName"
android:textAppearance="@style/TextAppearance.AppCompat.Display1"
android:layout_marginLeft="0dp"
android:layout_alignParentLeft="true" />

<EditText
android:id="@+id/txt_add_dnr"
style="@android:style/Widget.Holo.EditText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginTop="96dp"
android:ems="10"
android:hint="Address"
android:inputType="textPersonName"
android:textAppearance="@style/TextAppearance.AppCompat.Display1"
android:layout_alignParentLeft="true" />

64
<EditText
android:id="@+id/txt_mob_dnr"
style="@android:style/Widget.Holo.EditText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginStart="0dp"
android:layout_marginLeft="0dp"
android:layout_marginTop="193dp"
android:ems="10"
android:hint="Mobile"
android:inputType="number"
android:textAppearance="@style/TextAppearance.AppCompat.Display1" />

<EditText
android:id="@+id/txt_bld_dnr"
style="@android:style/Widget.Holo.EditText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"
android:layout_marginStart="0dp"
android:layout_marginLeft="0dp"
android:layout_marginBottom="122dp"
android:ems="10"
android:hint="Blood Group"
android:inputType="textPersonName"
android:textAppearance="@style/TextAppearance.AppCompat.Display1" />

<Button
android:id="@+id/btn_add_dnr"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentBottom="true"
android:layout_marginBottom="0dp"

65
android:height="80dp"
android:background="@color/colorAccent"
android:text="Add"
android:layout_alignParentLeft="true" />
</RelativeLayout>

Activity_admin_dnr_p.xml

<?xml version="1.0" encoding="utf-8"?>


<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".admin_dnr_p"
android:background="@drawable/a1">

<ImageButton
android:id="@+id/d_add"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginStart="0dp"
android:layout_marginLeft="0dp"
android:layout_marginTop="48dp"
android:scaleType="fitCenter"
app:srcCompat="@drawable/add" />

<ImageButton
android:id="@+id/d_edit"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginTop="45dp"
android:layout_marginEnd="0dp"
android:layout_marginRight="0dp"

66
android:scaleType="fitCenter"
app:srcCompat="@drawable/edit" />

<ImageButton
android:id="@+id/d_del"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_alignStart="@+id/d_add"
android:layout_alignLeft="@+id/d_add"
android:layout_alignParentBottom="true"
android:layout_marginStart="0dp"
android:layout_marginLeft="0dp"
android:layout_marginBottom="85dp"
android:scaleType="fitCenter"
app:srcCompat="@drawable/delete" />

<ImageButton
android:id="@+id/d_shhw"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_marginEnd="0dp"
android:layout_marginRight="0dp"
android:layout_marginBottom="87dp"
android:scaleType="fitCenter"
app:srcCompat="@drawable/show" />
</RelativeLayout>

Activity_admin_login.xml

<?xml version="1.0" encoding="utf-8"?>


<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".admin_log"

67
android:background="@drawable/a1">

<EditText
android:id="@+id/txt_username"
style="@android:style/Widget.Holo.EditText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="87dp"
android:ems="10"
android:hint="USERNAME"
android:inputType="textPersonName"
android:textAppearance="@style/TextAppearance.AppCompat.Display1" />

<EditText
android:id="@+id/txt_pass"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="198dp"
android:ems="10"
android:hint="PASSWORD"
android:inputType="textPassword"
android:textAppearance="@style/TextAppearance.AppCompat.Display1" />

<Button
android:id="@+id/btn_log"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentBottom="true"
android:layout_marginBottom="69dp"
android:height="80dp"
android:background="@color/colorAccent"
android:text="Login"
android:layout_alignParentLeft="true" />
</RelativeLayout>

68
Activity_admin_p.xml

<?xml version="1.0" encoding="utf-8"?>


<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".admin_p"
android:background="@drawable/a1">

<ImageButton
android:id="@+id/b_add"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginStart="0dp"
android:layout_marginLeft="0dp"
android:layout_marginTop="46dp"
android:scaleType="fitCenter"
app:srcCompat="@drawable/add" />

<ImageButton
android:id="@+id/b_edit"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginTop="44dp"
android:layout_marginEnd="0dp"
android:layout_marginRight="0dp"
android:scaleType="fitCenter"
app:srcCompat="@drawable/edit" />

<ImageButton
android:id="@+id/b_del"

69
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"
android:layout_marginStart="0dp"
android:layout_marginLeft="0dp"
android:layout_marginBottom="89dp"
android:scaleType="fitCenter"
app:srcCompat="@drawable/delete" />

<ImageButton
android:id="@+id/b_shhw"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_alignStart="@+id/b_edit"
android:layout_alignLeft="@id/b_edit"
android:layout_alignParentBottom="true"
android:layout_marginStart="9dp"
android:layout_marginLeft="9dp"
android:layout_marginBottom="86dp"
android:scaleType="fitCenter"
app:srcCompat="@drawable/show" />
</RelativeLayout>

Activity_admin_sel.xml

<?xml version="1.0" encoding="utf-8"?>


<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".admin_sel"
android:background="@drawable/a1">

<Button
android:id="@+id/b_bank_admin"

70
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="101dp"
android:height="80dp"
android:background="@color/colorAccent"
android:text="Blood Bank" />

<Button
android:id="@+id/b_dnr_admin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"
android:layout_marginStart="0dp"
android:layout_marginLeft="0dp"
android:layout_marginBottom="168dp"
android:background="@color/colorAccent"
android:text="Blood donor"
android:height="80dp"/>
</RelativeLayout>

Activity_del_bank.xml

<?xml version="1.0" encoding="utf-8"?>


<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".del_bank"
android:background="@drawable/a1">

<EditText
android:id="@+id/txt_id"
style="@android:style/Widget.Holo.EditText"
android:layout_width="wrap_content"

71
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="67dp"
android:ems="10"
android:hint="ID"
android:inputType="number"
android:textAppearance="@style/TextAppearance.AppCompat.Display1" />

<Button
android:id="@+id/del_btn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="206dp"
android:background="@color/colorAccent"
android:height="80dp"
android:text="Delete" />
</RelativeLayout>

Activity_del_dnr.xml

<?xml version="1.0" encoding="utf-8"?>


<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".del_dnr"
android:background="@drawable/a1">

<EditText
android:id="@+id/id_del_dnr"
style="@android:style/Widget.Holo.EditText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"

72
android:layout_centerHorizontal="true"
android:layout_marginTop="70dp"
android:ems="10"
android:hint="ID"
android:inputType="number"
android:textAppearance="@style/TextAppearance.AppCompat.Display1" />

<Button
android:id="@+id/btn_del_dnr"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:height="80dp"
android:background="@color/colorAccent"
android:text="Delete" />
</RelativeLayout>

Activity_del_dnr_req.xml

<?xml version="1.0" encoding="utf-8"?>


<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".del_dnr_req"
android:background="@drawable/a1">

<EditText
android:id="@+id/txt_del_req"
style="@android:style/Widget.Holo.EditText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="41dp"
android:ems="10"

73
android:hint="ID"
android:inputType="number"
android:textAppearance="@style/TextAppearance.AppCompat.Display1" />

<Button
android:id="@+id/btn_del_req"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginStart="0dp"
android:layout_marginLeft="0dp"
android:layout_marginTop="164dp"
android:background="@color/colorAccent"
android:text="Delete"
android:height="80dp"/>
</RelativeLayout>

Activity_edit_bank.xml

<?xml version="1.0" encoding="utf-8"?>


<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".edit_bank"
android:background="@drawable/a1">

<EditText
android:id="@+id/id_edit"
style="@android:style/Widget.Holo.EditText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"

74
android:layout_marginTop="18dp"
android:ems="10"
android:hint="ID"
android:inputType="textPersonName"
android:textAppearance="@style/TextAppearance.AppCompat.Display1" />

<EditText
android:id="@+id/nm_edit"
style="@android:style/Widget.Holo.EditText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginTop="125dp"
android:ems="10"
android:hint="Name"
android:inputType="textPersonName"
android:textAppearance="@style/TextAppearance.AppCompat.Display1"
android:layout_alignParentLeft="true" />

<EditText
android:id="@+id/add_edit"
style="@android:style/Widget.Holo.EditText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentBottom="true"
android:layout_marginBottom="210dp"
android:ems="10"
android:hint="Address"
android:inputType="textPersonName"
android:textAppearance="@style/TextAppearance.AppCompat.Display1"
android:layout_alignParentLeft="true" />

<EditText
android:id="@+id/mob_edit"
style="@android:style/Widget.Holo.EditText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"

75
android:layout_alignParentBottom="true"
android:layout_marginBottom="119dp"
android:ems="10"
android:hint="Mobile"
android:inputType="number"
android:textAppearance="@style/TextAppearance.AppCompat.Display1"
android:layout_alignParentLeft="true" />

<Button
android:id="@+id/edit_btn"
android:layout_width="match_parent"
android:layout_height="59dp"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"
android:layout_marginStart="0dp"
android:layout_marginLeft="0dp"
android:layout_marginBottom="19dp"
android:background="@color/colorAccent"
android:text="Edit" />
</RelativeLayout>

Activity_edit_dnr.xml

<?xml version="1.0" encoding="utf-8"?>


<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".edit_dnr"
android:background="@drawable/a1">

<EditText
android:id="@+id/id_edit_dnr"
style="@android:style/Widget.Holo.EditText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"

76
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:ems="10"
android:hint="ID"
android:inputType="number"
android:textAppearance="@style/TextAppearance.AppCompat.Display1"
android:layout_alignParentLeft="true" />

<EditText
android:id="@+id/nm_edit_dnr"
style="@android:style/Widget.Holo.EditText"
android:layout_width="match_parent"
android:layout_height="53dp"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginStart="0dp"
android:layout_marginLeft="0dp"
android:layout_marginTop="88dp"
android:ems="10"
android:hint="Name"
android:inputType="textPersonName"
android:textAppearance="@style/TextAppearance.AppCompat.Display1" />

<EditText
android:id="@+id/add_edit_dnr"
style="@android:style/Widget.Holo.EditText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginStart="0dp"
android:layout_marginLeft="0dp"
android:layout_marginTop="161dp"
android:ems="10"
android:hint="Address"
android:inputType="textPersonName"
android:textAppearance="@style/TextAppearance.AppCompat.Display1" />

77
<EditText
android:id="@+id/mob_edit_dnr"
style="@android:style/Widget.Holo.EditText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"
android:layout_marginStart="0dp"
android:layout_marginLeft="0dp"
android:layout_marginBottom="179dp"
android:ems="10"
android:hint="Mobile"
android:inputType="number"
android:textAppearance="@style/TextAppearance.AppCompat.Display1" />

<EditText
android:id="@+id/bld_edit_dnr"
style="@android:style/Widget.Holo.EditText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentBottom="true"
android:layout_marginBottom="83dp"
android:ems="10"
android:hint="Blood Group"
android:inputType="textPersonName"
android:textAppearance="@style/TextAppearance.AppCompat.Display1"
android:layout_alignParentLeft="true" />

<Button
android:id="@+id/btn_edit_dnr"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"
android:layout_marginStart="0dp"
android:layout_marginLeft="0dp"
android:background="@color/colorAccent"

78
android:text="Edit"
android:height="80dp"/>
</RelativeLayout>

Activity_enroll_donor.xml

<?xml version="1.0" encoding="utf-8"?>


<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".Enroll_donor"
android:background="@drawable/a1">

<EditText
android:id="@+id/txt_new_nm"
style="@android:style/Widget.Holo.EditText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginStart="0dp"
android:layout_marginLeft="0dp"
android:layout_marginTop="8dp"
android:ems="10"
android:hint="Name"
android:inputType="textPersonName"
android:textAppearance="@style/TextAppearance.AppCompat.Display1" />

<EditText
android:id="@+id/txt_new_add"
style="@android:style/Widget.Holo.EditText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"

79
android:layout_alignParentTop="true"
android:layout_marginTop="124dp"
android:ems="10"
android:hint="Address"
android:inputType="textPersonName"
android:textAppearance="@style/TextAppearance.AppCompat.Display1"
android:layout_alignParentLeft="true" />

<EditText
android:id="@+id/txt_new_mob"
style="@android:style/Widget.Holo.EditText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentBottom="true"
android:layout_marginStart="0dp"
android:layout_marginBottom="193dp"
android:ems="10"
android:hint="Mobile"
android:inputType="number"
android:textAppearance="@style/TextAppearance.AppCompat.Display1"
android:layout_marginLeft="0dp"
android:layout_alignParentLeft="true" />

<EditText
android:id="@+id/txt_new_bld"
style="@android:style/Widget.Holo.EditText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentBottom="true"
android:layout_marginBottom="95dp"
android:ems="10"
android:hint="Blood Group"
android:inputType="textPersonName"
android:textAppearance="@style/TextAppearance.AppCompat.Display1"
android:layout_alignParentLeft="true" />

<Button
android:id="@+id/btn_new_add"

80
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"
android:layout_marginStart="0dp"
android:layout_marginLeft="0dp"
android:background="@color/colorAccent"
android:text="Enroll"
android:height="80dp"/>
</RelativeLayout>

Activity_new_donor_request.xml

<?xml version="1.0" encoding="utf-8"?>


<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".new_donor_request"
android:background="@drawable/a1">

<ImageButton
android:id="@+id/ib_shw_new"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginStart="110dp"
android:layout_marginLeft="110dp"
android:layout_marginTop="72dp"
android:scaleType="fitCenter"
app:srcCompat="@drawable/show" />

<ImageButton

81
android:id="@+id/ib_del_new"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_alignStart="@+id/ib_shw_new"
android:layout_alignParentBottom="true"
android:layout_marginBottom="60dp"
android:scaleType="fitCenter"
app:srcCompat="@drawable/delete"
android:layout_alignLeft="@+id/ib_shw_new" />
</RelativeLayout>

Activity_search.xml

<?xml version="1.0" encoding="utf-8"?>


<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".search_bld_grp"
android:background="@drawable/a1">

<TextView
android:id="@+id/txt_A"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginStart="33dp"
android:layout_marginLeft="33dp"
android:layout_marginTop="15dp"
android:text="A"
android:textAppearance="@style/TextAppearance.AppCompat.Display1"
android:textColor="#F00"
android:textSize="60dp"
android:textStyle="bold" />

82
<TextView
android:id="@+id/txt_AP"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginTop="20dp"
android:layout_marginEnd="35dp"
android:layout_marginRight="35dp"
android:text="A+"
android:textColor="#F00"
android:textSize="60dp"
android:textStyle="bold" />

<TextView
android:id="@+id/txt_B"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignStart="@+id/txt_A"
android:layout_alignLeft="@+id/txt_A"
android:layout_alignParentTop="true"
android:layout_marginStart="4dp"
android:layout_marginLeft="4dp"
android:layout_marginTop="163dp"
android:text="B"
android:textColor="#F00"
android:textSize="60dp"
android:textStyle="bold" />

<TextView
android:id="@+id/txt_BP"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignStart="@+id/txt_AP"
android:layout_alignLeft="@+id/txt_AP"
android:layout_alignParentTop="true"
android:layout_marginStart="-2dp"
android:layout_marginLeft="-2dp"

83
android:layout_marginTop="163dp"
android:text="B+"
android:textColor="#F00"
android:textSize="60dp"
android:textStyle="bold" />

<TextView
android:id="@+id/txt_ABP"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignStart="@+id/txt_A"
android:layout_alignLeft="@+id/txt_A"
android:layout_alignParentBottom="true"
android:layout_marginStart="-16dp"
android:layout_marginLeft="-16dp"
android:layout_marginBottom="59dp"
android:text="AB+"
android:textColor="#F00"
android:textSize="60dp"
android:textStyle="bold" />

<TextView
android:id="@+id/txt_OP"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/txt_ABP"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginEnd="42dp"
android:layout_marginRight="42dp"
android:layout_marginBottom="0dp"
android:text="O+"
android:textColor="#F00"
android:textSize="60dp"
android:textStyle="bold" />
</RelativeLayout>

84
Package : Menu
Adminlogout.xml

<?xml version="1.0" encoding="utf-8"?>


<menu xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android">

<item
android:id="@+id/logout"
android:title="Log Out" />
</menu>

Adminmenu.xml

<menu xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android">

<item
android:id="@+id/ad_it_nw_req"
android:title="Enroll Request" />
</menu>

Usermenu.xml

<?xml version="1.0" encoding="utf-8"?>


<menu xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android">

<item
android:id="@+id/it_enrl"
android:title="Enroll as Donor" />
<item
android:id="@+id/it_about"

85
android:title="About Us" />
</menu>

Package : Values
Colors.xml

<?xml version="1.0" encoding="utf-8"?>


<resources>
<color name="colorPrimary">#008577</color>
<color name="colorPrimaryDark">#00574B</color>
<color name="colorAccent">#fff820</color>
</resources>

Ic_launcher_background.xml

<?xml version="1.0" encoding="utf-8"?>


<resources>
<color name="ic_launcher_background">#FFFF00</color>
</resources>

Strings.xml
<resources>
<string name="app_name">found</string>
</resources>

Styles.xml
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
</resources>

86
RESULTS
TABLES :-
Table Name :- Blood Bank

Column Data Type


Bank_id Integer
Bank_name Varchar
Bank_address Varchar
Bank_contact Integer

Table Name :- Blood Donor

Column Data Type


Donor_id Integer
Donor_name Varchar
Donor_address Varchar
Donor_contact Integer
Donor_blood_group Varchar

Table Name :- Enroll User Request

Column Data Type


User_id Integer
User_name Varchar
User_address Varchar
User_contact Integer
User_blood_group Varchar

87
SCREENSHOTS
User :-

88
89
Admin :-

90
91
92
93
94
FUTURE ENHANCEMENT

 In future there will be list of blood banks of more cities in Maharastra

 We will include more functionality as per user requirement

 Not a single application is ever considered as complete forever firstly

because there is always something new requirement also are growing day by

day

 We will provide the GPS Service to find the nearest blood bank for the user.

 We will also provide details of blood group and other medical information

of the blood donor.

95
REFERENCE AND BIBLIOGRAPHY

1) www.stackoverflow.com

2) www.github.com

3) www.youtube.com

4) www.simplifiedcoding.com

96

You might also like