Madlab
Madlab
2 Chandrashekar B 2GI19CS033
GUIDED by
Prof. Ravi Kalkundri
Ass. Prof. CSE Dept
KARNATAK LAW SOCIETY’S
GOGTE INSTITUTE OF TECHNOLOGY
UDYAMBAG, BELAGAVI-590008
(An Autonomous Institution under Visvesvaraya Technological University, Belagavi)
(APPROVED BY AICTE, NEW DELHI)
Department of CSE
CERTIFICATE
This is to certify that Anil Mane, Chandrashekar B, Darshan Patil and Ganesh Hindinmani of
7th semester and bearing USNs 2GI19CS020, 2GI19CS033, 2GI19CS037 and 2GI19CS042
have satisfactorily completed the course activity (Project) in MAD Lab course (Course code:
18CSL79). It can be considered as a bonafide work carried out in partial fulfillment for the
academic requirement of the 7th Semester B.E. CSE Department prescribed by KLS Gogte
Institute of Technology, Belagavi during the academic year 2022.- 2023
The report has been approved as it satisfies the academic requirements in respect of Course
activity prescribed for the said Degree.
Date: 05/01/2023
Marks allocation: (Page 2)
Batch No. :
1. Seminar/Project Title: Android Application for Marks USN/Roll No
Online Voting System Range
2GI19C 2GI19 2GI19 2GI19
S020 CS033 CS037 CS042
2. Abstract (PO2) 0-2
3. Application of the topic to the course (PO2) 0-3
4. Literature survey and its findings (PO2) 0-4
5. Methodology, Results and Conclusion
0-6
(PO1,PO3,PO4)
6. Report and Oral presentation skill (PO9,PO10) 0-5
Total 20
1) Title
2) Problem Statement for the project
3) Introduction to the topic
4) Design/Functional Block Diagram
5) Working Model
6) Working code for mini project
7) Conclusion
8) References
Title:
Online Voting System
Problem Statement For The Project :
Develop an android application that provides a new technique of casting votes
using mobile phones
Introduction to the topic:
ANDROID BASED ONLINE VOTING SYSTEM is an online voting technique. In this system
people who have citizenship of India and whose age is above 18 years of age and any sex can
give his vote online without going to any physical polling station. There is a database which is
maintained in which all the names of voters with complete information is stored.
In ANDROID BASED ONLINE VOTING SYSTEM a voter can use his voting right online
without any difficulty. He has to be registered first for him to vote. Registration is mainly done
by the system administrator for security reasons. The system Administrator registers the voters
on a special site of the system visited by him only by simply filling a registration form to
register voter. Citizens seeking registration are expected to contact the system administrator to
submit their details. After the validity of them being citizens of India has been confirmed by
the system administrator by comparing their details submitted with those in existing databases
such as those as the Registrar of Persons, the citizen is then registered as a voter. After
registration, the voter is assigned a secret Voter ID with which he/she can use to log into the
system and enjoy services provided by the system such as voting. If invalid/wrong details are
submitted, then the citizen is not registered to vote.
In the traditional system there was a need to go on the voting booth and cast a vote. People
from distinct places who did not have their voting cards cannot cast their votes. Also
authentication of the user was not good and appropriate. There was a lot of paper work which
was very time consuming. The results needed to be calculated manually which was very time
consuming process.
Therefore the proposed system is developed to remove the efforts needed in the traditional
voting process. The proposed system has an application developed on android phone via which
the user can cast his vote from anywhere on the face of the globe. The user registers by giving
his personal details which gets stored in the database at the server side. After the voting date is
fixed the user gets notification on the android phone via GCM (Google Cloud Messaging).
After that the user opens the application. The finger print authentication is done and then the
system will allow user to get into home screen. Then user opens the voting form he casts his
vote and then click on submits button and then logout. On the server side we can check the
results. The GCM is which sends notification to user’s android phone. The sqlite is the local
database of the user’s phone. If his internet connection is off then the notification and other
details get stored on his local server. When he starts his internet connection then this message
are retrieved from the GCM that is the local database of the android phone.
The Architecture of online voting System:
XML Code:
Activity_login.xml
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"
tools:context=".LoginActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@drawable/indiavotefinal"
android:padding="10dp"
android:gravity="center_vertical">
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardElevation="10dp"
app:contentPadding="10dp"
app:cardCornerRadius="5dp"
app:cardMaxElevation="12dp"
app:cardPreventCornerOverlap="true"
app:cardUseCompatPadding="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Login"
android:textSize="25dp"
android:textStyle="bold"/>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/filledTextFieldEmail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
android:hint="Email Id">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/emailLogin"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/filledTextFieldPass"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
android:hint="Password">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/password"
android:inputType="textPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</com.google.android.material.textfield.TextInputLayout>
<Button
android:id="@+id/login"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="Login as Voter"
app:backgroundTint="#FF5722" />
<Button
android:id="@+id/loginEC"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:backgroundTint="#3F51B5" />
<Button
android:id="@+id/loginECA"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:backgroundTint="#4CAF50" />
<Button
android:id="@+id/backToRegisterBtn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:backgroundTint="#FF9800" />
</LinearLayout>
</androidx.cardview.widget.CardView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="vertical">
<ProgressBar
android:id="@+id/progressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:visibility="gone" />
</LinearLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
JAVA Code:
MainActivity.java
package com.example.onlinevotingsystem;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AppCompatActivity;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.OnSuccessListener;
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.ValueEventListener;
import com.google.firebase.storage.FirebaseStorage;
import com.google.firebase.storage.StorageReference;
import com.google.firebase.storage.UploadTask;
import java.io.File;
@Override
super.onCreate(savedInstanceState);
user = FirebaseAuth.getInstance().getCurrentUser();
storageRef = FirebaseStorage.getInstance().getReference();
dbRef = FirebaseDatabase.getInstance().getReference();
if(user != null){
uid = user.getUid();
setContentView(R.layout.activity_main);
submitBtn = findViewById(R.id.submitBtn);
goBackToInfoPage = findViewById(R.id.goBackToInfoPage);
firstName = findViewById(R.id.firstName);
lastName = findViewById(R.id.lastName);
aadharNumber = findViewById(R.id.aadharNumber);
genderMale = findViewById(R.id.male);
genderFemale = findViewById(R.id.female);
genderOthers = findViewById(R.id.others);
datePicker = findViewById(R.id.datePicker);
chooseFileBtn = findViewById(R.id.chooseFileBtn);
genderGrp = findViewById(R.id.genderGrp);
cardView = findViewById(R.id.uploadVoter);
try{
//Toast.makeText(getApplicationContext(),subDbRef.toString(),Toast.LENGTH_LONG).show();
subDbRef.addValueEventListener(new ValueEventListener() {
@RequiresApi(api = Build.VERSION_CODES.O)
@Override
//Toast.makeText(getApplicationContext(),snapshot.child("hasSubmitted").getValue().toString(),Toast.LENGTH_LONG).show();
if(snapshot.hasChild("hasSubmitted")){
if(snapshot.child("hasSubmitted").getValue().toString().equals("true")){
firstName.setText(fName);
lastName.setText(lName);
genderGrp.clearCheck();
if(gender.equals("male"))genderMale.setChecked(true);
else if(gender.equals("female"))genderFemale.setChecked(true);
else genderOthers.setChecked(true);
aadharNumber.setText(aadharNum);
datePicker.updateDate(2000,11,24);
goBackToInfoPage.setVisibility(View.VISIBLE);
}
}
@Override
Toast.makeText(getApplicationContext(),error.getMessage(),Toast.LENGTH_LONG).show();
});
}catch(Exception e){
Toast.makeText(getApplicationContext(),e.getMessage(),Toast.LENGTH_LONG).show();
chooseFileBtn.setOnClickListener(new View.OnClickListener() {
@Override
intent.setType("*/*");
intent.setAction(ACTION_GET_CONTENT);
});
submitBtn.setOnClickListener(new View.OnClickListener() {
@Override
if(genderMale.isChecked())gender = "male";
if(fName.trim().equals("")){
return;
}
else if(lName.trim().equals("")){
return;
else if(fName.trim().contains("12")){
return;
else if(lName.trim().contains("12")){
return;
else if(fName.trim().contains("\"")){
return;
else if(lName.trim().contains("\"")){
return;
return;
}else{
dbRef.child("user-data").child(uid).setValue(curUser).addOnSuccessListener(new OnSuccessListener<Void>() {
@Override
startActivity(new Intent(getApplicationContext(),InfoActivity.class));
}).addOnFailureListener(new OnFailureListener() {
@Override
Toast.makeText(getApplicationContext(),e.getMessage(),Toast.LENGTH_LONG).show();
});
}
}
});
goBackToInfoPage.setOnClickListener(new View.OnClickListener() {
@Override
startActivity(new Intent(getApplicationContext(),InfoActivity.class));
});
@Override
cardView.setVisibility(View.GONE);
}).addOnFailureListener(new OnFailureListener() {
@Override
cardView.setVisibility(View.GONE);
});
if (requestCode == REQUEST_CODE_FILES && resultCode == RESULT_OK && data != null && data.getData() != null) {
file = data.getData();
// if(count==0){
// return;
// }
// if(count==1){
// count += 1;
// return;
// }
cardView.setVisibility(View.VISIBLE);
putFileInStorage(file);
}
OUTPUT:
Voter Resistation:
Candidate Resistation:
Admin Login:
Conclusion:
This Online Voting system will manage the Voters information by which voter can login and
use his voting rights. The system will incorporate all features of Voting system. It provides the
tools for maintaining voters vote to every party and it count total no. of votes of every party.
There is a DATABASE which is maintained by the ELECTION COMMISION OF INDIA in
which all the names of voter with complete information is stored.In this user who is above 18
years register his/her information on the database and when he/she want to vote he/she has to
login by his id and password and can vote to any party only single time. Voting detail store in
database and the result is displayed by calculation. By online voting system percentage of
voting is increases. It decreases the cost and time of voting process. It is very easy to use and
It is vary less time consuming. It is very easy to debug
References:
1. https://github.com/yashtailor/OnlineVotingSystem.git
2. About Android operating system https://en.wikipedia.org/wiki/Android_
(operating_system)
3. About Android Studio on Wikipedia https://en.wikipedia.org/wiki/ Android_Studio
4. About fingerprint api and integration https://www.bayometric.com/ fingerprint-sdk-
api-integration-phones/
5. About Sqlite https://www.youtube.com/watcv=cp2rL3sAFmI&list=
PLS1QulWo1RIaRdy16cOzBO5Jr6kEagA07
6. About Using fingerprint authentication, https://www.youtube.com/watch?v=
zYA5SJgWrLk
7. To know all tool and componets of android development, https://developers.
google.com/