You are on page 1of 19

KARNATAK LAW SOCIETY’S

GOGTE INSTITUTE OF TECHNOLOGY


UDYAMBAG, BELAGAVI-590008
(An Autonomous Institution under Visvesvaraya Technological University, Belagavi)
(APPROVED BY AICTE, NEW DELHI)

Course Activity Report

Android application for ONLINE VOTING SYSTEM


Submitted in the partial fulfillment for the academic requirement of
7th Semester B.E.
in
Mobile Application Development Lab

Sl no Name of Student USN

1 Anil Mane 2GI19CS020

2 Chandrashekar B 2GI19CS033

3 Darshan Patil 2GI19CS037

4 Ganesh Hindinmani 2GI19CS042

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.

Signature of the Faculty Member Signatureof the HOD

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

* 20 marks is converted to 10 marks for CGPA calculation

1.Engineering Knowledge: Apply the knowledge of mathematics, science, engineering


fundamentals and an engineering specialization to the solution of complex engineering
problems.
2.Problem Analysis: Identify, formulate, review research literature, and analyze complex
engineering problems reaching substantiated conclusions using first principles of mathematics,
natural sciences and Engineering sciences.
3.Design/Development of solutions:Design solutions for complex engineering problems and
design system components or processes that meet the specified needs with appropriate
consideration for the public health and safety, and the cultural, societal, and environmental
considerations.
4.Conduct investigations of complex problems: Use research-based knowledge and research
methods including design of experiments, analysis and interpretation of data, and synthesis of
the information to provide valid conclusions.
5.Modern tool usage:Create, select, and apply appropriate techniques, resources, and modern
engineering and IT tools including prediction and modeling to complex engineering activities
with an understanding of the limitations.
6.The engineer and society:Apply reasoning informed by the contextual knowledge to assess
societal, health, safety, legal and cultural issues and the consequent responsibilities relevant to
the professional engineering practice.
7.Environment and sustainability: Understand the impact of the professional engineering
solutions in societal and environmental contexts, and demonstrate the knowledge of, and need
for sustainable development.
8.Ethics: Apply ethical principles and commit to professional ethics and responsibilities and
norms of the engineering practice.
9.Individual and team work: Function effectively as an individual and as a member or leader
in diverse teams, and in multidisciplinary settings.
10.Communication: Communicate effectively on complex engineering activities with the
engineering community and with society at large, such as, being able to comprehend and write
effective reports and design documentation, make effective presentations, and give and receive
clear instructions.
11. Project management and finance: Demonstrate knowledge and understanding of the
engineering management principles and apply these to one's own work, as a member and leader
in a team, to manage projects and in multidisciplinary environments.
12. Life-long learning: Recognize the need for and have the preparation and ability to engage
in independent and lifelong learning in the broadest context of technological channel
Index

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">

<!--this is the actual edit text which takes the input-->

<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">

<!--this is the actual edit text which takes the input-->

<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 for Login with text "Login" -->

<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"

android:text="Login as Election Candidate"

app:backgroundTint="#3F51B5" />

<Button

android:id="@+id/loginECA"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:text="Login as Election Commission Authority"

app:backgroundTint="#4CAF50" />

<Button

android:id="@+id/backToRegisterBtn"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:text="Don't have an account? Register here."

app:backgroundTint="#FF9800" />

</LinearLayout>

</androidx.cardview.widget.CardView>

<!-- ProgressBar for loading time -->

<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 static android.content.Intent.ACTION_GET_CONTENT;

import static android.content.Intent.createChooser;

import java.io.File;

public class MainActivity extends AppCompatActivity {

private String uid;

private Button submitBtn;

private EditText firstName,lastName,aadharNumber;

private RadioButton genderMale,genderFemale,genderOthers;

private RadioGroup genderGrp;

private DatePicker datePicker;

private Button chooseFileBtn;

private Button goBackToInfoPage;

private static final int REQUEST_CODE_FILES = 1;

private Uri file;

private DatabaseReference dbRef;

private StorageReference storageRef;

private FirebaseUser user;

private UploadTask uploadTask;

private int count = 0;

private LinearLayout cardView;

@Override

protected void onCreate(Bundle savedInstanceState)

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{

DatabaseReference subDbRef = dbRef.child("user-data").child(uid);

//Toast.makeText(getApplicationContext(),subDbRef.toString(),Toast.LENGTH_LONG).show();

subDbRef.addValueEventListener(new ValueEventListener() {

@RequiresApi(api = Build.VERSION_CODES.O)

@Override

public void onDataChange(@NonNull DataSnapshot snapshot) {

//Toast.makeText(getApplicationContext(),snapshot.child("hasSubmitted").getValue().toString(),Toast.LENGTH_LONG).show();

if(snapshot.hasChild("hasSubmitted")){

if(snapshot.child("hasSubmitted").getValue().toString().equals("true")){

String fName = snapshot.child("fName").getValue().toString();

String lName = snapshot.child("lName").getValue().toString();

String dob = snapshot.child("dob").getValue().toString();

String aadharNum = snapshot.child("aadharNum").getValue().toString();

String gender = snapshot.child("gender").getValue().toString();

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

public void onCancelled(@NonNull DatabaseError error) {

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

public void onClick(View v) {

Intent intent = new Intent();

intent.setType("*/*");

intent.setAction(ACTION_GET_CONTENT);

startActivityForResult(createChooser(intent, "Select File"), REQUEST_CODE_FILES);

});

submitBtn.setOnClickListener(new View.OnClickListener() {

@Override

public void onClick(View v) {

String fName = firstName.getText().toString();

String lName = lastName.getText().toString();

String aadharNum = aadharNumber.getText().toString();

String gender = null;

if(genderMale.isChecked())gender = "male";

else if(genderFemale.isChecked())gender = "female";

else gender ="others";

int day = datePicker.getDayOfMonth();

int month = datePicker.getMonth();

int year = datePicker.getYear();

String dob = String.valueOf(day)+"/"+String.valueOf(month+1)+"/"+String.valueOf(year);

if(fName.trim().equals("")){

Toast.makeText(getApplicationContext(),"First Name Cannot Be Empty",Toast.LENGTH_LONG).show();

return;

}
else if(lName.trim().equals("")){

Toast.makeText(getApplicationContext(),"Last Name Cannot Be Empty",Toast.LENGTH_LONG).show();

return;

else if(fName.trim().contains("12")){

Toast.makeText(getApplicationContext(),"First Name cannot have a number",Toast.LENGTH_LONG).show();

return;

else if(lName.trim().contains("12")){

Toast.makeText(getApplicationContext(),"Last Name cannot have a number",Toast.LENGTH_LONG).show();

return;

else if(fName.trim().contains("\"")){

Toast.makeText(getApplicationContext(),"First Name cannot have \"",Toast.LENGTH_LONG).show();

return;

else if(lName.trim().contains("\"")){

Toast.makeText(getApplicationContext(),"Last Name cannot have \"",Toast.LENGTH_LONG).show();

return;

else if(aadharNum.trim().length() != 12){

Toast.makeText(getApplicationContext(),"Aadhar Number must be a 12 digit number",Toast.LENGTH_LONG).show();

return;

}else{

User curUser = new User(fName,lName,gender,dob,aadharNum,"true","false","",uid);

dbRef.child("user-data").child(uid).setValue(curUser).addOnSuccessListener(new OnSuccessListener<Void>() {

@Override

public void onSuccess(Void aVoid) {

Toast.makeText(getApplicationContext(),"Submitted Sucessfully! Under


Review!",Toast.LENGTH_LONG).show();

startActivity(new Intent(getApplicationContext(),InfoActivity.class));

}).addOnFailureListener(new OnFailureListener() {

@Override

public void onFailure(@NonNull Exception e) {

Toast.makeText(getApplicationContext(),e.getMessage(),Toast.LENGTH_LONG).show();

});

}
}

});

// initialising all views through id defined above

goBackToInfoPage.setOnClickListener(new View.OnClickListener() {

@Override

public void onClick(View v) {

startActivity(new Intent(getApplicationContext(),InfoActivity.class));

});

public void putFileInStorage(final Uri file) {

String uid = user.getUid();

final StorageReference upload = storageRef.child(uid).child("aadhar-file");

uploadTask = (UploadTask) upload.putFile(file).addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>()


{

@Override

public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {

Toast.makeText(MainActivity.this, "Aadhar Image Upload Successfully!", Toast.LENGTH_SHORT).show();

cardView.setVisibility(View.GONE);

}).addOnFailureListener(new OnFailureListener() {

@Override

public void onFailure(@NonNull Exception e) {

Toast.makeText(MainActivity.this, e.getMessage(), Toast.LENGTH_SHORT).show();

cardView.setVisibility(View.GONE);

});

protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {

super.onActivityResult(requestCode, resultCode, data);

if (requestCode == REQUEST_CODE_FILES && resultCode == RESULT_OK && data != null && data.getData() != null) {

file = data.getData();

// if(count==0){

// Toast.makeText(getApplicationContext(), "PDF Type Not supported", Toast.LENGTH_SHORT).show();


// count += 1;

// return;

// }

// if(count==1){

// Toast.makeText(getApplicationContext(), "Doc Type Not supported", Toast.LENGTH_SHORT).show();

// 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/

You might also like