"Blood Donation Android Application": A Mini Project Report On
"Blood Donation Android Application": A Mini Project Report On
"Blood Donation Android Application": A Mini Project Report On
BACHELOR OF TECHNOLOGY
In
COMPUTER SCIENCE AND ENGINEERING
By
YAHYA (18H11A0541)
ADHITHYA (18U61A0514)
AQUIB AHMED (18U61A0501)
ABDUL DANISH (18U61A0502)
Date: 05-01-2022
CERTIFICATE
This is to certify that the project work entitled “Blood Donation Android Application”,
is a bonafide work of ADHITHYA (18U61A0514), AQUIB AHMED (18U61A0501), ABDUL
DANISH (18U61A0502) & YAHYA (18H11A0541) submitted in partial fulfillment of the
requirement for the award of Bachelor of Technology in Computer Science and Engineering during
the Academic year 2021-22. This is further certified that the work done under my guidance, and
the results of this work have not been submitted elsewhere for the award of any other degree or
diploma.
EXTERNAL EXAMINER
_______________________
ACKNOWLEDGEMENT
We are thankful to our guide Mrs. G. Pavani, Assistant Professor of CSE Department for
her valuable guidance for successful completion of this project.
We express our sincere thanks to Mr. Syed Mazharuddin, Project Coordinator for giving
us an opportunity to undertake the project “Blood Donation Android Application” and for
enlightening us on various aspects of our project work and assistance in the evaluation of
material and facts. He not only encouraged us to take up this topic but also given valuable
guidance in assessing facts and arriving at conclusions.
We are also most obliged and grateful to Mr. Syed Mazharuddin, Associate Professor and
Head, Department of CSE for giving us guidance in completing this project successfully. We
express our heart-felt gratitude to our Vice-Principal Mr. G Ahmed Zeeshan, Co-Ordinator
Internal Quality Assurance Cell (IQAC) for his constant guidance, cooperation, motivation and
support which have always kept us going ahead.
We owe a lot of gratitude to him for always being there for us. We are also most obliged
and grateful to our Principal Prof. Dr. K. Sivalingam for giving us guidance in completing this
project successfully.
We also thank our parents for their constant encourage and support without which the
project would have not come to an end. Last but not the least, we would also like to thank all our
class mates who have extended their cooperation during our project work.
ADHITHYA (18U61A0514)
AQUIB AHMED (18U61A0501)
ABDUL DANISH (18U61A0502)
YAHYA (18H11A0541)
DECLARATION
We hereby declare that the project work entitled BLOOD DONATION ANDROID
APPLICATION, submitted to Department of Computer Science and Engineering, Global
Institute of Engineering & Technology, Moinabad, affiliated to JNTUH, Hyderabad in partial
fulfillment of the requirement for the award of the degree of BACHELOR OF TECHNOLOGY
in Computer Science and Engineering is the work done by us and has not been submitted elsewhere
for the award of any degree or diploma.
ADHITHYA (18U61A0514)
AQUIB AHMED (18U61A0501)
ABDUL DANISH (18U61A0502)
YAHYA (18H11A0541)
VISION:
The vision of the department is to produce professional computer science engineers
who can meet the expectations of the globe and contribute to the advancement of
engineering and technology which involves creativity and innovations by providing
an excellent learning environment with thebest quality facilities.
MISSION:
PROGRAMME OUTCOMES:
PO 12: Lifelong learning: recognize the need for, and have the preparation and
ability to engage in independent and lifelong learning in the broader context of
technological change.
ABSTRACT:
“Blood Point” is a mobile-based project developed in android platform. This Java android project
provides an easy and fast way to search for blood donors. This app enables users to find blood in
emergency situations. Here Users can easily find the details of donors and receivers through their
mobiles. Users need to register with the application to view all the information which is available
on the app. The user can search the details and find the details of the blood donors. Users can get
brief details about the donor’s contact details including their location. The user can make a call or
message directly by using this application.
1
Department of CSE
Blood Donation Android Application
TABLE OF CONTENTS:
List of figures 03
1. Introduction 04
1.1 Objective 05
1.2 Purpose 06
1.3 Existing Model 07
1.4 Proposed Model 07
2. Literature survey 08
2.1 E-Donation Application 09
2.2 Mobile donor Tracker 10
3. System analysis 11
3.1 Class Diagram 12
3.2 Use Case Diagram 13
3.3 Sequence Diagram 14
4. System Requirement Specification 15
4.1 Software Requirements 16
4.2 Hardware Requirements 16
5. System Implementation 17
5.1 Introduction 18
5.2 Android Studio 18
5.3 Understanding IDEs & SDK 19
5.4 Firebase 21
5.5 Project Hierarchy 22
5.5.1 Logical Implementation (Java) 23
5.5.2 Design Implementation (XML) 59
6. Result 64
7. Conclusion 69
8. Reference 70
2
Department of CSE
Blood Donation Android Application
List of Figures
3
Department of CSE
Blood Donation Android Application
Chapter 1
Introduction
4
Department of CSE
Blood Donation Android Application
Overview:
Over the past few years, India has been focused on improving health indicators across rural
and urban areas. However, ensuring safe and adequate blood, which is fundamental to our
healthcare system, still remains a huge challenge and a gap area. Despite all its efforts, India fell
short of 1.9 million units of blood in 2016-17 – equivalent to 60 tankers. If you account for the
challenges specific to a country like India – poor health-seeking behavior, higher disease burden,
limited access to healthcare facilities – having a robust blood system is the critical need of the
hour.
Even today, India is heavily dependent on replacement blood donation, wherein family or
friends are asked to donate blood in lieu of the units given to a patient. However, this form of blood
donation does not necessarily replace the blood group or quantity administered and leads to
increased risk of transfusion-transmissible infections.
A blood donation is a process whereby a person voluntarily has blood drawn to be used for
future transfusions when in need at hospitals for treatment procedures that require them. Donation
may be of whole blood (blood drawn directly from the body) or of specific components of the
blood; such as red blood cells, white blood cells, plasma, and platelets. Blood banks often
participate in the process of collecting blood and other procedures such as managing stocks,
approving blood requests and updating donation information.
“Blood Point” is an android application to collect or donate blood easily. Users who have
an android phone & active internet connection can contact and start searching for a donor easily
through this application. The purpose of this application is to help people belonging to rural areas.
The Blood Bank Android Project is one of the great technical life saver applications. The
main aim of this application is to reduce the time spent in searching of blood donors in case of
emergency. This system will keep track of all the latest updates relevant to the people who donate
blood and who had donated blood in case of emergency.
This Blood Bank Android Project system will specify all the details related to the donor
such as their name, their address, their mobile number, their blood group and so on. The one who
need blood, just have to login into the system which will hardly take few seconds and then the one
who needs the blood get access to all the available group of bloods in nearby blood banks as well
as details of those who can donate blood in urgent.
5
Department of CSE
Blood Donation Android Application
1.1 Objective:
The main aim of developing this system is to provide blood to the people who are in
need of blood. The number of persons who are in need of blood are increasing in large number
day by day. Using this system user can search blood group available in the city and he can also
get contact number of the donor who has the same blood group he needs. In order to help people
who are in need of blood, this Online Blood Bank management system can be used effectively
for getting the details of available blood groups and user can also get contact number of the
blood donors having the same blood group and within the same city. So if the blood group is not
available in the blood bank user can request the donor to donate the blood to him and save
someone life. Using this bank management system people can register himself or herself who
want to donate blood. To register in the system they have to enter their contact information like
address, mobile number, Blood group, etc.
This blood bank management system is easily available to everyone. When a person
want to donate blood he can by looking at the list of people who want blood (have to register to
the system). Donor registration is very easy, to get register to the system he have to fill up
registration form. After submitting the registration form he can create username and password.
Donor have to give information like blood group, contact details etc. donor can also change his
account information when he wants using his username and password.
Using this blood bank system people can search blood group available which they are
needed. They check it online using our blood bank app. If in case blood group is not available
in blood bank they can also get contact numbers of the persons who has the same blood group
he is need. And he can request the person to donate the blood for saving someone life. Our
system also allow user to search online the person who have the same blood group he needs and
if he find a donor in his city then we give him all details of the donor, if he doesn’t find any
donor then he is given the contact numbers and addresses of the Life Saving Contact Persons.
1.2 Purpose:
To bridge the gap between blood banks, hospitals, volunteer donors and needy
people, through this system.
To facilitate the search process for needy people and make it easier than before.
To reduce the data entry process.
6
Department of CSE
Blood Donation Android Application
To use GPS service for locating the hospitals, blood banks & volunteer donors to
know if the seeker is near to or not.
Some blood types are rare so the system can find the required donors with the
required blood type easily from the huge database by using search feature in the
android app.
The application was designed to maximize the blood donation potential of millions of
healthy smartphone owners which is currently underwhelming given that the degree of
voluntarism is low, with different blood collecting organizations resorting to schools among
other institutions of learning in order to organize the blood donation drives. By maximizing the
blood donation potential of the healthy smartphone users, there will be a lot more blood units in
stock for when patients require it while also going along way in enabling Uganda improve its
compliance in ensuring the number of blood units in stock corresponds to the 1% of the total
population as per World Bank Regulations.
It is a mobile application so the cost of time and labor work will be less compare to existing
model
One can contact the seeker or donor and complete their transaction formalities via on phone
7
Department of CSE
Blood Donation Android Application
Chapter 2
Literature Survey
8
Department of CSE
Blood Donation Android Application
The Mobile Blood Donor Tracker proposed by Samy. S, [6] is a mobile application that
connects users with Blood Centers to facilitate the blood collection from donors during
emergencies, facilitate the communication of blood donors with each other and facilitate the
communication of blood donors with the Hospital blood center. It is an application developed by
making use of the following technologies: MySQL database-used by the application to manage
the low-level work of data by sending it commands, Service based location-a software application
9
Department of CSE
Blood Donation Android Application
for IP capable mobile devices, Android-the Linux based open source platform backed by Google,
and the Android System Architecture, among others. The documentation on this application makes
a case for leveraging the increasing number of smart phone users to enhance the effectiveness of
blood donation.
The number of smart phone users globally will exceed 2 billion in 2016, according to new
statistics from e Marketer-after almost getting there in 2015. Next year, there will be more than
1.91 billion smart phone users nationwide, a figure that will boost an extra 12.6% close to 2.16
billion in 2016., their paper quotes before going on to propose a mobile blood donor tracking
system application that works on Android smart phones.
10
Department of CSE
Blood Donation Android Application
Chapter 3
System Analysis
11
Department of CSE
Blood Donation Android Application
System analysis:
System Analysis in software engineering is, therefore, the activities that comprise software
engineering as a process in the production of software. It is the software process. Our project
mainly works on web application side. In this project, we emphasized system analysis with
different list of Diagrams which are constructed using UML concepts.
12
Department of CSE
Blood Donation Android Application
So only static behavior is not sufficient to model a system rather dynamic behavior is more
important than static behavior. In UML there are five diagrams available to model dynamic
nature and use case diagram is one of them. Now as we have to discuss that the use case diagram
is dynamic in nature there should be some internal or external factors for making the interaction.
13
Department of CSE
Blood Donation Android Application
14
Department of CSE
Blood Donation Android Application
Chapter 4
System Specification Requirements
15
Department of CSE
Blood Donation Android Application
Software Requirements
Hardware Requirements
4.1.1 Software Requirements:
Android Studio
Firebase
Gradle
Languages Used:
Java
XML
4.1.2 Hardware Requirements:
RAM 3 GB
Storage 16 GB
Snapdragon 460 or above
16
Department of CSE
Blood Donation Android Application
Chapter 5
System Implementation
17
Department of CSE
Blood Donation Android Application
5.1 Introduction:
Blood Point is an Android Application build using Java Language. Before moving onto the
Implementation part let us first understand the Tools used for building this application. Following
are the tools used in developing this project.
On May 7, 2019, Kotlin replaced Java as Google's preferred language for Android app
development. Java is still supported, as is C++.
A specific feature of the Android Studio is an absence of the possibility to switch autosave feature
off.
The following features are provided in the current stable version:
18
Department of CSE
Blood Donation Android Application
Android Virtual Device (Emulator) to run and debug apps in the Android studio.
Android Studio supports all the same programming languages of IntelliJ (and CLion) e.g., Java,
C++, and more with extensions, such as Go; and Android Studio 3.0 or later supports Kotlin and
"all Java 7 language features and a subset of Java 8 language features that vary by platform
version." External projects backport some Java 9 features. While IntelliJ states that Android Studio
supports all released Java versions, and Java 12, it's not clear to what level Android Studio supports
Java versions up to Java 12 (the documentation mentions partial Java 8 support). At least some
new language features up to Java 12 are usable in Android.
Once an app has been compiled with Android Studio, it can be published on the Google Play Store.
The application has to be in line with the Google Play Store developer content policy.
SDK:
The Android SDK (software development kit) is a set of development tools used to develop
applications for the Android platform that has become Apple’s biggest rival in the smartphone
space. The Android SDK includes the following:
Required libraries
Debugger.
An emulator.
Relevant documentation for the Android application program interfaces (APIs).
Sample source code.
Tutorials for the Android OS.
Every time Google releases a new version of Android, a corresponding SDK is also released. To
be able to write programs with the latest features, developers must download and install each
version’s SDK for the particular phone. The SDK essentially represents Android’s delivered
toolkit for a specific version and technology of its operating systems.
The development platforms that are compatible with SDK include operating systems like Windows
(XP or later), Linux (any recent Linux distribution) and Mac OS X (10.4.9 or later). The
components of Android SDK can be downloaded separately. Third-party add-ons are also available
for download.
Although the SDK can be used to write Android programs in the command prompt, the most
common method is by using an integrated development environment (IDE). The recommended
IDE is Eclipse with the Android Development Tools (ADT) plug-in. However, other IDEs, such
as NetBeans or IntelliJ, will also work.
Most of these IDEs provide a graphical interface enabling developers to perform development
tasks faster. Since Android applications are written in Java code, a user should have the Java
Development Kit (JDK) installed.
19
Department of CSE
Blood Donation Android Application
In addition, experts sometimes talk about optimizing the use of SDKs for Android, for instance,
using targeted versioning to eliminate the need for additional wrapped API calls, or may refer to
SDK targeting as “value-added to an Android manifest” that can help with OS implementations,
many recommending setting a target version and a minimum version in the manifest.
Other related resources include tips for optimized installation and the use of the Android SDK
Manager.
One thing that the IDEs do, as implied above, is consolidate various tools into one single
environment. For example, if an IDE provides functionality for a text editor, compiler and
debugger altogether, (where each of those things would be treated separately in dealing with an
SDK,) that offers evident benefits for the developer.
Experts also explain how IDEs, for example, Netbeans, create graphical user interface or more
user-friendly versions of development environments that would be considered more manually or
basically implemented in SDKs.
A good analogy might be the use of HTML to code webpages contrasted with the emergence of
many platforms, (early ones including Dreamweaver, for example,) that provided GUIs over the
HTML environment for implementation.
By abstracting the underlying tasks in this way, the GUIs make the tasks more accessible to a
wider set of users, and can help to save time and effort. The IDE does this for the Android
developer, although some argue that too many shortcuts compromises the core knowledge that the
developer needs to be confident in a variety of environments.
An Android Virtual Device (AVD) is a configuration that defines the characteristics of an Android
phone, tablet, Wear OS, Android TV, or Automotive OS device that you want to simulate in the
Android Emulator. The AVD Manager is an interface you can launch from Android Studio that
helps you create and manage AVDs.
20
Department of CSE
Blood Donation Android Application
5.4 Firebase:
Firebase is a platform developed by Google for creating
mobile and web applications. It was originally an
independent company founded in 2011. In 2014,
Google acquired the platform and it is now their
flagship offering for app development.
Firebase offers a number of services, including:
21
Department of CSE
Blood Donation Android Application
Android Project is created using 2 different languages, java and xml mainly. The logical
Implementation deals with the working of the android app, java language is used as a logical view.
The design implementation deals with the design structure of our android app, the android studio
generates xml files as we add buttons, create form for our android application. Based on xml
structure the java code is created for every action event such as buttons, forms, drawers etc.
22
Department of CSE
Blood Donation Android Application
Activities:
Activities folder deals with the activity of a user on an blood point application. Below are the
java files used in activity folder.
Log inactivity:
This java file creates a logical Activity for sign in form of blood point application.
LoginActivity.java
23
Department of CSE
Blood Donation Android Application
package com.android.iunoob.Blood_point.activities;
import android.app.ProgressDialog;
import android.content.Intent;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import com.android.iunoob.Blood_point.R;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
pd = new ProgressDialog(this);
pd.setMessage("Loading...");
pd.setCancelable(true);
pd.setCanceledOnTouchOutside(false);
mAuth = FirebaseAuth.getInstance();
if(mAuth.getCurrentUser() != null)
{
Intent intent = new Intent(getApplicationContext(), Dashboard.class);
startActivity(intent);
finish();
}
inputemail = findViewById(R.id.input_username);
inputpassword = findViewById(R.id.input_password);
signin = findViewById(R.id.button_login);
24
Department of CSE
Blood Donation Android Application
signup = findViewById(R.id.button_register);
resetpass = findViewById(R.id.button_forgot_password);
signin.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
try {
if(password.length()>0 && email.length()>0) {
pd.show();
mAuth.signInWithEmailAndPassword(email, password)
.addOnCompleteListener(LoginActivity.this, new
OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (!task.isSuccessful()) {
Toast.makeText(getApplicationContext(),
"Authentication Failed",
Toast.LENGTH_LONG).show();
Log.v("error", task.getException().getMessage());
} else {
Intent intent = new Intent(getApplicationContext(), Dashboard.class);
startActivity(intent);
finish();
}
pd.dismiss();
}
});
}
else
{
Toast.makeText(getApplicationContext(), "Please fill all the field.",
Toast.LENGTH_LONG).show();
}
} catch (Exception e)
{
e.printStackTrace();
}
}
});
signup.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(getApplicationContext(), ProfileActivity.class);
startActivity(intent);
}
25
Department of CSE
Blood Donation Android Application
});
resetpass.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(getApplicationContext(), RestorePassword.class);
startActivity(intent);
}
});
PostActivity:
The post activity comprises of logical view for posting the request of blood group on a home view list
PostActivity.java
package com.android.iunoob.Blood_point.activities;
import android.app.ProgressDialog;
import android.content.Intent;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.Toast;
import com.android.iunoob.Blood_point.R;
import com.android.iunoob.Blood_point.viewmodels.UserData;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.Query;
import com.google.firebase.database.ValueEventListener;
import java.util.Calendar;
ProgressDialog pd;
26
Department of CSE
Blood Donation Android Application
FirebaseDatabase fdb;
DatabaseReference db_ref;
FirebaseAuth mAuth;
Calendar cal;
String uid;
String Time, Date;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_post);
pd = new ProgressDialog(this);
pd.setMessage("Loading...");
pd.setCancelable(true);
pd.setCanceledOnTouchOutside(false);
text1 = findViewById(R.id.getMobile);
text2 = findViewById(R.id.getLocation);
spinner1 = findViewById(R.id.SpinnerBlood);
spinner2 = findViewById(R.id.SpinnerDivision);
btnpost = findViewById(R.id.postbtn);
cal = Calendar.getInstance();
if(cal.get(Calendar.AM_PM) ==1)
{
ampm = "PM";
}
27
Department of CSE
Blood Donation Android Application
if(hour<10)
{
Time += "0";
}
Time += hour;
Time +=":";
if(min<10) {
Time += "0";
}
Time +=min;
Time +=(" "+ampm);
Date = day+"/"+month+"/"+year;
if(cur_user == null)
{
startActivity(new Intent(PostActivity.this, LoginActivity.class));
} else {
uid = cur_user.getUid();
}
mAuth = FirebaseAuth.getInstance();
fdb = FirebaseDatabase.getInstance();
db_ref = fdb.getReference("posts");
try {
btnpost.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
pd.show();
final Query findname = fdb.getReference("users").child(uid);
if(text1.getText().length() == 0)
{
Toast.makeText(getApplicationContext(), "Enter your contact number!",
Toast.LENGTH_LONG).show();
}
else if(text2.getText().length() == 0)
{
Toast.makeText(getApplicationContext(), "Enter your location!",
Toast.LENGTH_LONG).show();
}
else {
findname.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
28
Department of CSE
Blood Donation Android Application
if (dataSnapshot.exists()) {
db_ref.child(uid).child("Name").setValue(dataSnapshot.getValue(UserData.class).getName());
db_ref.child(uid).child("Contact").setValue(text1.getText().toString());
db_ref.child(uid).child("Address").setValue(text2.getText().toString());
db_ref.child(uid).child("Division").setValue(spinner2.getSelectedItem().toString());
db_ref.child(uid).child("BloodGroup").setValue(spinner1.getSelectedItem().toString());
db_ref.child(uid).child("Time").setValue(Time);
db_ref.child(uid).child("Date").setValue(Date);
Toast.makeText(PostActivity.this, "Your post has been created successfully",
Toast.LENGTH_LONG).show();
startActivity(new Intent(PostActivity.this, Dashboard.class));
} else {
Toast.makeText(getApplicationContext(), "Database error occured.",
Toast.LENGTH_LONG).show();
}
@Override
public void onCancelled(DatabaseError databaseError) {
Log.d("User", databaseError.getMessage());
}
});
}
}
});
}
catch (Exception e)
{
e.printStackTrace();
}
pd.dismiss();
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
onBackPressed();
return true;
}
return super.onOptionsItemSelected(item);
}
}
29
Department of CSE
Blood Donation Android Application
ProfileActivity:
The profile activity deals with the profile updating activity where a user can change its name, blood group
and other details
ProfileActivity.java
package com.android.iunoob.Blood_point.activities;
import android.app.ProgressDialog;
import android.content.Intent;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.Toast;
import com.android.iunoob.Blood_point.R;
import com.android.iunoob.Blood_point.viewmodels.UserData;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.Query;
import com.google.firebase.database.ValueEventListener;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
pd = new ProgressDialog(this);
pd.setMessage("Loading...");
30
Department of CSE
Blood Donation Android Application
pd.setCancelable(true);
pd.setCanceledOnTouchOutside(false);
pd.show();
setContentView(R.layout.activity_profile);
db_User = FirebaseDatabase.getInstance();
db_ref = db_User.getReference("users");
donor_ref = db_User.getReference("donors");
mAuth = FirebaseAuth.getInstance();
inputemail = findViewById(R.id.input_userEmail);
inputpassword = findViewById(R.id.input_password);
retypePassword = findViewById(R.id.input_password_confirm);
fullName = findViewById(R.id.input_fullName);
gender = findViewById(R.id.gender);
address = findViewById(R.id.inputAddress);
division = findViewById(R.id.inputDivision);
bloodgroup = findViewById(R.id.inputBloodGroup);
contact = findViewById(R.id.inputMobile);
isDonor = findViewById(R.id.checkbox);
btnSignup = findViewById(R.id.button_register);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
if (mAuth.getCurrentUser() != null) {
inputemail.setVisibility(View.GONE);
inputpassword.setVisibility(View.GONE);
retypePassword.setVisibility(View.GONE);
btnSignup.setText("Update Profile");
pd.dismiss();
/// getActionBar().setTitle("Profile");
getSupportActionBar().setTitle("Profile");
findViewById(R.id.image_logo).setVisibility(View.GONE);
isUpdate = true;
if (userData != null) {
pd.show();
fullName.setText(userData.getName());
gender.setSelection(userData.getGender());
address.setText(userData.getAddress());
contact.setText(userData.getContact());
bloodgroup.setSelection(userData.getBloodGroup());
31
Department of CSE
Blood Donation Android Application
division.setSelection(userData.getDivision());
Query donor = donor_ref.child(division.getSelectedItem().toString())
.child(bloodgroup.getSelectedItem().toString())
.child(mAuth.getCurrentUser().getUid());
donor.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
if(dataSnapshot.exists())
{
isDonor.setChecked(true);
isDonor.setText("Unmark this to leave from donors");
}
else
{
Toast.makeText(ProfileActivity.this, "Your are not a donor! Be a donor and save
life by donating blood.",
Toast.LENGTH_LONG).show();
}
pd.dismiss();
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
Log.d("User", databaseError.getMessage());
}
});
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
Log.d("User", databaseError.getMessage());
}
});
} else pd.dismiss();
btnSignup.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final String email = inputemail.getText().toString();
final String password = inputpassword.getText().toString();
final String ConfirmPassword = retypePassword.getText().toString();
final String Name = fullName.getText().toString();
final int Gender = gender.getSelectedItemPosition();
32
Department of CSE
Blood Donation Android Application
try {
if (Name.length() <= 2) {
ShowError("Name");
fullName.requestFocusFromTouch();
} else if (Contact.length() <= 11) {
ShowError("Contact Number");
contact.requestFocusFromTouch();
} else if (Address.length() <= 2) {
ShowError("Address");
address.requestFocusFromTouch();
} else {
if (!isUpdate) {
if (email.length() == 0) {
ShowError("Email ID");
inputemail.requestFocusFromTouch();
} else if (password.length() <= 5) {
ShowError("Password");
inputpassword.requestFocusFromTouch();
} else if (password.compareTo(ConfirmPassword) != 0) {
Toast.makeText(ProfileActivity.this, "Password did not match!",
Toast.LENGTH_LONG)
.show();
retypePassword.requestFocusFromTouch();
} else {
pd.show();
mAuth.createUserWithEmailAndPassword(email, password)
.addOnCompleteListener(ProfileActivity.this, task -> {
if (!task.isSuccessful()) {
Toast.makeText(ProfileActivity.this, "Registration failed! try agian.",
Toast.LENGTH_LONG)
.show();
Log.v("error", task.getException().getMessage());
} else {
String id = mAuth.getCurrentUser().getUid();
db_ref.child(id).child("Name").setValue(Name);
db_ref.child(id).child("Gender").setValue(Gender);
db_ref.child(id).child("Contact").setValue(Contact);
db_ref.child(id).child("BloodGroup").setValue(BloodGroup);
db_ref.child(id).child("Address").setValue(Address);
db_ref.child(id).child("Division").setValue(Division);
if(isDonor.isChecked())
33
Department of CSE
Blood Donation Android Application
donor_ref.child(div).child(blood).child(id).child("UID").setValue(id).toString();
donor_ref.child(div).child(blood).child(id).child("TotalDonate").setValue(0);
donor_ref.child(div).child(blood).child(id).child("Name").setValue(Name);
donor_ref.child(div).child(blood).child(id).child("Contact").setValue(Contact);
donor_ref.child(div).child(blood).child(id).child("Address").setValue(Address);
finish();
}
pd.dismiss();
});
}
} else {
String id = mAuth.getCurrentUser().getUid();
db_ref.child(id).child("Name").setValue(Name);
db_ref.child(id).child("Gender").setValue(Gender);
db_ref.child(id).child("Contact").setValue(Contact);
db_ref.child(id).child("BloodGroup").setValue(BloodGroup);
db_ref.child(id).child("Address").setValue(Address);
db_ref.child(id).child("Division").setValue(Division);
if(isDonor.isChecked())
{
donor_ref.child(div).child(blood).child(id).child("UID").setValue(id).toString();
donor_ref.child(div).child(blood).child(id).child("LastDonate").setValue("Don't
donate yet!");
donor_ref.child(div).child(blood).child(id).child("TotalDonate").setValue(0);
donor_ref.child(div).child(blood).child(id).child("Name").setValue(Name);
donor_ref.child(div).child(blood).child(id).child("Contact").setValue(Contact);
donor_ref.child(div).child(blood).child(id).child("Address").setValue(Address);
}
else
34
Department of CSE
Blood Donation Android Application
donor_ref.child(div).child(blood).child(id).removeValue();
}
Toast.makeText(getApplicationContext(), "Your account has been updated!",
Toast.LENGTH_LONG)
.show();
Intent intent = new Intent(ProfileActivity.this, Dashboard.class);
startActivity(intent);
finish();
}
pd.dismiss();
}
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
onBackPressed();
return true;
}
return super.onOptionsItemSelected(item);
}
}
35
Department of CSE
Blood Donation Android Application
Adapters:
BloodRequestAdapter:
This adapter deals with the request of blood group, the reciepents check the homeview where donors
posts their requirements.
BloodRequestAdapter.java
package com.android.iunoob.Blood_point.adapters;
import android.graphics.Color;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.android.iunoob.Blood_point.R;
import com.android.iunoob.Blood_point.viewmodels.CustomUserData;
import java.util.List;
Name = itemView.findViewById(R.id.reqstUser);
contact = itemView.findViewById(R.id.targetCN);
bloodgroup = itemView.findViewById(R.id.targetBG);
Address = itemView.findViewById(R.id.reqstLocation);
posted = itemView.findViewById(R.id.posted);
36
Department of CSE
Blood Donation Android Application
}
}
@Override
public PostHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
@Override
public void onBindViewHolder(PostHolder postHolder, int i) {
if(i%2==0)
{
postHolder.itemView.setBackgroundColor(Color.parseColor("#C13F31"));
}
else
{
postHolder.itemView.setBackgroundColor(Color.parseColor("#FFFFFF"));
}
@Override
public int getItemCount() {
return postLists.size();
}
}
37
Department of CSE
Blood Donation Android Application
SearchDonorAdapter:
The list of donors is numerous; thus this adapter is used to find donors with respective to their location.
SearchDonorAdapter.java
package com.android.iunoob.Blood_point.adapters;
import android.graphics.Color;
import androidx.annotation.NonNull;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.recyclerview.widget.RecyclerView;
import com.android.iunoob.Blood_point.R;
import com.android.iunoob.Blood_point.viewmodels.DonorData;
import java.util.List;
Name = itemView.findViewById(R.id.donorName);
contact = itemView.findViewById(R.id.donorContact);
totaldonate = itemView.findViewById(R.id.totaldonate);
Address = itemView.findViewById(R.id.donorAddress);
posted = itemView.findViewById(R.id.lastdonate);
}}
public SearchDonorAdapter(List<DonorData> postLists)
{
this.postLists = postLists;
}
@Override
public PostHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
38
Department of CSE
Blood Donation Android Application
@Override
public void onBindViewHolder(PostHolder postHolder, int i) {
if(i%2==0)
{
postHolder.itemView.setBackgroundColor(Color.parseColor("#C13F31"));
}
else
{
postHolder.itemView.setBackgroundColor(Color.parseColor("#FFFFFF"));
}
DonorData donorData = postLists.get(i);
postHolder.Name.setText("Name: "+donorData.getName());
postHolder.contact.setText(donorData.getContact());
postHolder.Address.setText("Address: "+donorData.getAddress());
postHolder.totaldonate.setText("Total Donation: "+donorData.getTotalDonate()+" times");
postHolder.posted.setText("Last Donation: "+donorData.getLastDonate());
@Override
public int getItemCount() {
return postLists.size();
}
}
39
Department of CSE
Blood Donation Android Application
Fragments:
Below are the fragments files that are used in our android project
AboutUs:
The AboutUS java file is an static view where it displays project credits and developers details
AboutUs.java
package com.android.iunoob.Blood_point.fragments;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import android.app.Fragment;
import android.text.util.Linkify;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.android.iunoob.Blood_point.R;
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.aboutus, container, false);
getActivity().setTitle("About us");
textView = view.findViewById(R.id.txtv);
Linkify.addLinks(textView, Linkify.ALL);
return view;
40
Department of CSE
Blood Donation Android Application
}
}
HomeView:
This java file is used to show blood reciepents information in the home page
HomeView.java
package com.android.iunoob.Blood_point.fragments;
import android.app.ProgressDialog;
import android.os.Build;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import android.app.Fragment;
import androidx.annotation.RequiresApi;
import androidx.recyclerview.widget.DefaultItemAnimator;
import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;
import com.android.iunoob.Blood_point.R;
import com.android.iunoob.Blood_point.adapters.BloodRequestAdapter;
import com.android.iunoob.Blood_point.viewmodels.CustomUserData;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.Query;
import com.google.firebase.database.ValueEventListener;
import java.util.ArrayList;
import java.util.List;
41
Department of CSE
Blood Donation Android Application
public HomeView() {
@RequiresApi(api = Build.VERSION_CODES.M)
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
recentPosts.setLayoutManager(new LinearLayoutManager(getContext()));
donor_ref = FirebaseDatabase.getInstance().getReference();
postLists = new ArrayList<>();
pd = new ProgressDialog(getActivity());
pd.setMessage("Loading...");
pd.setCancelable(true);
pd.setCanceledOnTouchOutside(false);
mAuth = FirebaseAuth.getInstance();
getActivity().setTitle("Blood Point");
AddPosts();
return view;
}
private void AddPosts()
{
Query allposts = donor_ref.child("posts");
pd.show();
allposts.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
42
Department of CSE
Blood Donation Android Application
if(dataSnapshot.exists()) {
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
Log.d("User", databaseError.getMessage());
}
});
@Override
public void onResume() {
super.onResume();
}
@Override
public void onStop() {
super.onStop();
}
@Override
public void onPause() {
super.onPause();
}
@Override
public void onDestroy() {
super.onDestroy();
}
}
43
Department of CSE
Blood Donation Android Application
NearByHospitalActivity:
This java file deals with the logical Implementation of the search system which make use of Maps api
i.e., google services.
NearByHospitalActivity.java
package com.android.iunoob.Blood_point.fragments;
import android.Manifest;
import android.annotation.SuppressLint;
import android.content.pm.PackageManager;
import android.location.Location;
import android.os.Build;
import android.os.Bundle;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import com.android.iunoob.Blood_point.R;
import com.android.iunoob.Blood_point.viewmodels.GetNearbyPlacesData;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.location.FusedLocationProviderClient;
import com.google.android.gms.location.LocationListener;
import com.google.android.gms.location.LocationRequest;
import com.google.android.gms.location.LocationServices;
import com.google.android.gms.location.LocationSettingsRequest;
import com.google.android.gms.location.SettingsClient;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;
import com.google.android.gms.tasks.OnSuccessListener;
import org.jetbrains.annotations.Nullable;
44
Department of CSE
Blood Donation Android Application
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
return view;
}
@Override
public void onViewCreated(@NonNull final View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
fusedLocationProviderClient = LocationServices.getFusedLocationProviderClient(getActivity());
@SuppressLint("MissingPermission")
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull
int[] grantResults) {
switch (requestCode) {
case Permission_Request:
45
Department of CSE
Blood Donation Android Application
@Override
public void onMapReady(@NonNull GoogleMap googleMap) {
mMap = googleMap;
if (ContextCompat.checkSelfPermission(requireActivity(),
Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
buildGoogleApiClient();
mMap.setMyLocationEnabled(true);
mMap.setTrafficEnabled(true);
}
@Override
public void onConnected(@Nullable Bundle bundle) {
locationRequest = new LocationRequest();
locationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
46
Department of CSE
Blood Donation Android Application
if (ActivityCompat.checkSelfPermission(getActivity(),
Manifest.permission.ACCESS_FINE_LOCATION) !=
PackageManager.PERMISSION_GRANTED
&& ActivityCompat.checkSelfPermission(getActivity(),
Manifest.permission.ACCESS_COARSE_LOCATION) !=
PackageManager.PERMISSION_GRANTED) {
Toast.makeText(getActivity(), "You need to enable permissions to display location !",
Toast.LENGTH_SHORT).show();
}
fusedLocationProviderClient.getLastLocation().addOnSuccessListener(getActivity(), new
OnSuccessListener<Location>() {
@Override
public void onSuccess(Location location) {
ShowHospitals(location.getLatitude(), location.getLongitude());
}
});
return googlePlaceUrl.toString();
}
if (ActivityCompat.shouldShowRequestPermissionRationale(getActivity(),
Manifest.permission.ACCESS_FINE_LOCATION)) {
ActivityCompat.requestPermissions(getActivity(), new
String[]{Manifest.permission.ACCESS_FINE_LOCATION}, Permission_Request);
} else {
ActivityCompat.requestPermissions(getActivity(), new
String[]{Manifest.permission.ACCESS_FINE_LOCATION}, Permission_Request);
}
}
}
47
Department of CSE
Blood Donation Android Application
@Override
public void onConnectionSuspended(int i) {
@Override
public void onConnectionFailed(@NonNull ConnectionResult connectionResult) {
@Override
public void onLocationChanged(Location location) {
lastlocation = location;
LatLng latLng = new LatLng(location.getLatitude() , location.getLongitude());
MarkerOptions markerOptions = new MarkerOptions();
markerOptions.position(latLng);
markerOptions.title("Current Location");
markerOptions.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_BLUE));
currentLocationmMarker = mMap.addMarker(markerOptions);
mMap.moveCamera(CameraUpdateFactory.newLatLng(latLng));
mMap.animateCamera(CameraUpdateFactory.zoomBy(0));
@Override
public void onStart() {
super.onStart();
if(client!=null)
{
client.connect();
}
}
getNearbyPlacesData.execute(dataTransfer);
Toast.makeText(getContext(), "Showing Nearby Hospitals", Toast.LENGTH_SHORT).show();
}
}
48
Department of CSE
Blood Donation Android Application
SeachDonorFragment:
This java file creates a logical Implementation to find blood donors nearby.
SeachDonorFragment.java
package com.android.iunoob.Blood_point.fragments;
import android.app.ProgressDialog;
import android.os.Build;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import android.app.Fragment;
import androidx.annotation.RequiresApi;
import androidx.recyclerview.widget.DefaultItemAnimator;
import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.Spinner;
import android.widget.Toast;
import com.android.iunoob.Blood_point.R;
import com.android.iunoob.Blood_point.adapters.SearchDonorAdapter;
import com.android.iunoob.Blood_point.viewmodels.DonorData;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.Query;
import com.google.firebase.database.ValueEventListener;
import java.util.ArrayList;
import java.util.List;
FirebaseAuth mAuth;
FirebaseUser fuser;
FirebaseDatabase fdb;
DatabaseReference db_ref, user_ref;
49
Department of CSE
Blood Donation Android Application
public SearchDonorFragment() {
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
pd = new ProgressDialog(getActivity());
pd.setMessage("Loading...");
pd.setCancelable(true);
pd.setCanceledOnTouchOutside(false);
mAuth = FirebaseAuth.getInstance();
fuser = mAuth.getCurrentUser();
fdb = FirebaseDatabase.getInstance();
db_ref = fdb.getReference("donors");
bloodgroup = view.findViewById(R.id.btngetBloodGroup);
division = view.findViewById(R.id.btngetDivison);
btnsearch = view.findViewById(R.id.btnSearch);
btnsearch.setOnClickListener(new View.OnClickListener() {
@RequiresApi(api = Build.VERSION_CODES.M)
@Override
public void onClick(View v) {
pd.show();
donorItem = new ArrayList<>();
donorItem.clear();
sdadapter = new SearchDonorAdapter(donorItem);
recyclerView = (RecyclerView) view.findViewById(R.id.showDonorList);
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
RecyclerView.LayoutManager searchdonor = new LinearLayoutManager(getContext());
recyclerView.setLayoutManager(searchdonor);
50
Department of CSE
Blood Donation Android Application
recyclerView.setItemAnimator(new DefaultItemAnimator());
recyclerView.addItemDecoration(new DividerItemDecoration(getActivity(),
LinearLayoutManager.VERTICAL));
recyclerView.setAdapter(sdadapter);
Query qpath = db_ref.child(division.getSelectedItem().toString())
.child(bloodgroup.getSelectedItem().toString());
qpath.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
if(dataSnapshot.exists())
{
for(DataSnapshot singleitem : dataSnapshot.getChildren())
{
DonorData donorData = singleitem.getValue(DonorData.class);
donorItem.add(donorData);
sdadapter.notifyDataSetChanged();
}
}
else
{
}
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
Log.d("User", databaseError.getMessage());
}
});
pd.dismiss();
}
});
return view;
}
51
Department of CSE
Blood Donation Android Application
Viewmodels:
The view model consists of logical files that are used to fetch and store the details of user which can be
donor or recipient. Below is the list of files used in view model.
import java.io.Serializable;
public CustomUserData() {
public CustomUserData(String address, String division, String contact, String name, String
bloodGroup, String time, String date) {
Address = address;
Division = division;
Contact = contact;
Name = name;
BloodGroup = bloodGroup;
Time = time;
Date = date;
}
52
Department of CSE
Blood Donation Android Application
53
Department of CSE
Blood Donation Android Application
DonorData:
DonorData.java
package com.android.iunoob.Blood_point.viewmodels;
public DonorData() {
public DonorData(int totalDonate, String lastDonate, String Name, String Contact, String Address,
String UID) {
this.TotalDonate = totalDonate;
this.LastDonate = lastDonate;
this.Name = Name;
this.Contact = Contact;
this.UID = UID;
this.Address = Address;
}
54
Department of CSE
Blood Donation Android Application
GetNearbyPlacesData:
GetNearbyPlacesData.java
package com.android.iunoob.Blood_point.viewmodels;
import android.os.AsyncTask;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
String googlePlacesData;
GoogleMap mMap;
55
Department of CSE
Blood Donation Android Application
String url;
@Override
protected String doInBackground(Object... objects) {
mMap = (GoogleMap) objects[0];
url = (String) objects[1];
return googlePlacesData;
}
@Override
protected void onPostExecute(String s) {
showNearbyPlaces(nearbyPlaceList);
}
markerOptions.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_BLUE));
mMap.addMarker(markerOptions);
mMap.moveCamera(CameraUpdateFactory.newLatLng(latLng));
mMap.animateCamera(CameraUpdateFactory.zoomBy(10));
}
56
Department of CSE
Blood Donation Android Application
}
}
Userdata:
Userdata.java
package com.android.iunoob.Blood_point.viewmodels;
public UserData() {
57
Department of CSE
Blood Donation Android Application
this.BloodGroup = bloodGroup;
}
58
Department of CSE
Blood Donation Android Application
1. Drawable
2. Layout
3. Menu
4. Values
59
Department of CSE
Blood Donation Android Application
Drawable:
This folder keeps the files of intro application. Intro logo of our android application is displayed
in figure below.
Layout:
Layout folder consist of xml files that requires heavy components such as login form,
registration form, dashboard, posting card view etc.,
This Layout manager deals with the internal operation of the application and highly works using
java logical part.
Following are the xml files used in layout manager
60
Department of CSE
Blood Donation Android Application
61
Department of CSE
Blood Donation Android Application
Fig 5.5.2.7: homeView Fig 5.5.2.8: Search Adapter Fig 5.5.2.9: Find Near
by Hospital
Menu:
This folder keeps files of menu view that are of 2 types, hamburger menu view and triple dot menu
view. Each menu consists of layouts that displays child layouts.
Here Activity_dashboard_drawer.xml file shows the dashboard view whereas the dashboard.xml
file shows the view of blood information and developers details.
Values:
Values folder keeps the values files that are beneficial for entire project, values such as strings
keeps the record of cities and android application, the dimens and colors file keep the values of
62
Department of CSE
Blood Donation Android Application
colors used and dimens of each layout. Google maps api keeps the values used for google maps
navigation.
63
Department of CSE
Blood Donation Android Application
Chapter 6
Results
64
Department of CSE
Blood Donation Android Application
Authentication:
Authentication is the process of recognizing a user's identity. ... Different systems may require
different types of credentials to ascertain a user's identity. The credential often takes the form of a
password, which is a secret and known only to the individual and the system.
In firebase we can manage & manipulate user authentication data by adding, disabling, removing
or reseting the password of the user.
65
Department of CSE
Blood Donation Android Application
66
Department of CSE
Blood Donation Android Application
67
Department of CSE
Blood Donation Android Application
68
Department of CSE
Blood Donation Android Application
7. Conclusion:
A majority of the donors were willing to be regular donors. The donors showed positive effects
like a sense of satisfaction after the donation. Creating an opportunity for blood donation by
conducting many blood donation camps may increase the voluntary blood donations.
Our Application is a beneficial Software, by building a life saving application which helps in
donation of blood as well as finding blood hospitals nearby, bridges the gap of donating blood
online in case of emergency.
69
Department of CSE
Blood Donation Android Application
8. Reference:
https://developer.android.com/guide
https://en.wikipedia.org/wiki/Android_Studio
https://firebase.google.com/docs/build
Telusko: https://www.youtube.com/channel/UC59K-uG2A5ogwIrHw4bmlEg
https://en.wikipedia.org/wiki/Blood_donation_in_India
https://science.thewire.in/health/india-must-change-its-approach-to-blood-donation/
70
Department of CSE