Blood Finder Application
Blood Finder Application
Blood Finder Application
PROJECT REPORT
ON
BLOOD FINDER APPLICATION
UNDER THE PARTIAL FULFILMENT OF UNIVERSITY OF
MUMBAI REQUIREMENT FOR THE COURSE OF
TYBSC (COMPUTER SCIENCE)
-: SUBMITTED BY :-
1
INDEX
03 System Design
3.1 E-R Diagram 14
04 Code Implementation 21
05 Results
5.1 Tables 87
06 Future Scope 95
2
ACKNOWLEDGEMENT
gratitude to all those who have shown me the path to bring out the various colours
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
I also take this opportunity to thank Head of the Department Dr. Mrs. Saloni
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
Last but not the least, I would like to thank my friends and family for the support
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
The purpose of making this application is to save the user’s time for searching blood of
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
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
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.
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
emergency 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
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,
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
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
Advantages :-
This system can be used to view all the donor details and accordingly select
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.
The application can prove very beneficial into the clinics, hospitals as the
Disadvantages :-
The android mobile user will not be able to insert or view details if the
This app cannot be run on any other Platform rather than Android i.e.
(Apple, Blackberry)
Suburban’s
The application cannot be run on the API less than 15 i.e. (Jellybean)
8
REQUIREMENT SPECIFICATION
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 :-
HARDWARE REQUIREMENTS :-
Hard Disk :- 5 GB
RAM :- 8 GB
ANDROID DEVICE
FUNCTIONAL REQUIREMENT :-
ADMIN :-
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.
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 :
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
Reliability
Security
Availability
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 :-
If the user preform an unusual or illegal kind of task then the admin may wish to
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
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
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()
15
USE CASE DIAGRAM :-
ADMIN
Enroll User
request for donor
16
USER
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
Logout
Exit
18
DATA FLOW DIAGRAM
ADMIN :-
Admin
Login to
System
Manage
Modules
19
USER :-
Search
User
Modules
Enroll to be
a Donor
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" />
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
}
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;
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();
}
@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();
}
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;
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;
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;
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;
@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;
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());
}
});
}
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;
@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) {
}
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;
}
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;
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;
}
}
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;
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;
}
}
Activity_main.xml
<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
<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
<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
<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
<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
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
<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
<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
<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
<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
<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
<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
<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
<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
<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
<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
<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
<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
Ic_launcher_background.xml
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
87
SCREENSHOTS
User :-
88
89
Admin :-
90
91
92
93
94
FUTURE ENHANCEMENT
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
95
REFERENCE AND BIBLIOGRAPHY
1) www.stackoverflow.com
2) www.github.com
3) www.youtube.com
4) www.simplifiedcoding.com
96