You are on page 1of 16

MOBILE APPLICATION DEVELOPMENT PROJECT

A REPORT

On
QUIZ APPLICATION

Submitted by

C.PRASHANTH-RA1511008010177
P.SHASHANK-RA1511008010091
In partial fulfillment

For the award of the degree


of
BACHELOR OF TECHNOLOGY
IN
INFORMATION TECHNOLOGY

SRM University, SRM Nagar, Kattankulathur-603203 Kancheepuram District,


Tamil Nadu
BONAFIDE CERTIFICATE

Certified that the project report on QUIZ APPLICATION is a proof of successful

completion of mini project undergone by C.PRASHANTH (RA1511008010177) &

P.SHASHANK(RA1511008010091) in SRM UNVIERSITY located at Kattankulathur.

Date Signature of staff in-charge


DECLARATION

I hereby declare that the project report submitted titled “Quiz App”, is a record
of mini project which I completed in the SRM UNIVERSITY during the 5th
semester(July-December 2017)

Date :

Name : C.PRASHANTH , P.SHASHANK

Register Number: RA1511008010177, RA1511008010091

Signature of Student
TABLE OF CONTENTS

CONTENT PAGE NUMBER

1)ABSTRACT 3

2)CONCEPT 4

4)DESIGN 5

5)CODE 6

6)RESULT 11
ABSTRACT

The Quiz app is a sophisticated well-designed application which runs on


the android framework. The concept of quizzes is currently very popular
among educated circles as well as in entertainment shows. Though the quiz
can be conducted manually, it often needs elaborate preparations. Quizzes
contribute to the growth of knowledge of an individual and they are a popular
source of entertainment. This program In JAVA focuses on creating interactive
quizzes from CRICKET. The program utilizes most of the important concepts in
JAVA . The final output is envisioned to be a user-friendly interactive quiz with
which the user can gain significant knowledge and get entertainment with
value-addition.

SCOPE OF THE APPLICATION

1.Objectives:

1. To provide a well-designed interface which is friendly with the


user.
2. To test the user their knowledge about cricket.
3. To provide ease of use and efficient performance.

2.Background

In the world of modern applications, we planned to design an


application that will provide an opportunity to store whatever he wishes to
type on his phone permanently and allow modifications in the future.

3.Targeted audiences:

1. Day to day users


2. SRM Students
3. Youngsters
4. Cricket lovers

4.Requirements: Android 5.0 and above

SHARED PREFERENCES
Android provides many ways of storing data of an application. One of this
way is called Shared Preferences. Shared Preferences allow you to save and
retrieve data in the form of key,value pair.In order to use shared preferences,
you have to call a method getSharedPreferences() that returns a
SharedPreference instance pointing to the file that contains the values of
preferences.

SharedPreferences sharedpreferences = getSharedPreferences(MyPREFERENCES,


Context.MODE_PRIVATE);

You can save something in the sharedpreferences by using


SharedPreferences.Editor class.You will call the edit method of
SharedPreference instance and will receive it in an editor object.

List View

Android ListView is a view which groups several items and display them in
vertical scrollable list. The list items are automatically inserted to the list using
an Adapter that pulls content from a source such as an array or database. An
adapter actually bridges between UI components and the data source that fill
data into UI Component. Adapter holds the data and send the data to adapter
view, the view can take the data from adapter view and shows the data on
different views like as spinner, list view, grid view etc. The ListView and GridView
are subclasses of AdapterView and they can be populated by binding them to an
Adapter, which retrieves data from an external source and creates a View that
represents each data entry. Android provides several subclasses of Adapter that
are useful for retrieving different kinds of data and building views for an
AdapterView ( i.e. ListView or GridView). The common adapters are
ArrayAdapter,Base Adapter, CursorAdapter,
SimpleCursorAdapter,SpinnerAdapter and WrapperListAdapter

DESIGN

USE CASE DIAGRAM


The given diagram showcases several use cases for the application and how
they communicate with the actors. There are two types of actors, User and
Admin. User is the end user who uses the application and admin is the one
behind who manages the application. The admin pushes updates, fix errors
and bugs and maintains a smooth flow for the application. The user uses the
application for his everyday activities.

Block Diagram

Relative Layout
Android RelativeLayout enables you to specify how child views are positioned
relative to each other. The position of each view can be specified as relative
to sibling elements or relative to the parent.Using RelativeLayout, you can
align two elements by right border, or make one below another, centered in
the screen, centered left, and so on.

CODE
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.saidu.prasproject2.MainActivity">

<Button
android:id="@+id/startu2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"
android:layout_marginBottom="21dp"
android:layout_marginStart="137dp"
android:onClick="startu"
android:text="Start" />

<TextView
android:id="@+id/ggtime"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginTop="25dp"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true" />

<TextView
android:id="@+id/question"
android:layout_width="wrap_content"
android:layout_height="100dp"
android:layout_alignParentEnd="true"
android:layout_alignParentStart="true"
android:layout_alignTop="@+id/ggtime"
android:layout_marginTop="87dp" />

<RadioGroup xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_below="@+id/question"
android:id="@+id/radioGroup">
<RadioButton
android:id="@+id/op1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"

android:layout_marginTop="13dp" />
<RadioButton
android:id="@+id/op2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_below="@+id/op1" />

<RadioButton
android:id="@+id/op3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_below="@+id/op2" />

<RadioButton
android:id="@+id/op4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_below="@+id/op3" />

</RadioGroup>
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignTop="@+id/ggtime"
android:layout_marginTop="41dp"
android:text="question 1"

android:onClick="q1"
/>

<Button
android:id="@+id/button3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/button2"
android:layout_toEndOf="@+id/button2"
android:text="question 2"

android:onClick="q2"/>

<Button
android:id="@+id/button4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/button3"
android:layout_toEndOf="@+id/button3"
android:text="question 3"

android:onClick="q3"
/>

<Button
android:id="@+id/next"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="next"
android:onClick="pras"
android:layout_below="@+id/radioGroup"
android:layout_toEndOf="@+id/startu2" />
<TextView
android:id="@+id/score"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_above="@+id/startu2"
android:layout_alignParentStart="true"
android:textSize="30dp" />

MAIN ACTIVITY
ackage com.example.saidu.prasproject2;

import android.content.SharedPreferences;
import android.graphics.Color;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.RadioButton;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity {


int q1o=0,q2o=0;

CountDownTimer timer;
TextView gg,question,score;
Button startu2,qq1,next,qq2,qq3;
RadioButton op1,op2,op3,op4;
SharedPreferences mPrefs;
SharedPreferences.Editor editor;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

gg=(TextView)findViewById(R.id.ggtime);
score=(TextView)findViewById(R.id.score);
question=(TextView)findViewById(R.id.question);
op1=(RadioButton)findViewById(R.id.op1);
op2=(RadioButton)findViewById(R.id.op2);
op3=(RadioButton)findViewById(R.id.op3);
op4=(RadioButton)findViewById(R.id.op4);
startu2=(Button)findViewById(R.id.startu2);
qq1=(Button)findViewById(R.id.button2);
qq2=(Button)findViewById(R.id.button3);
qq3=(Button)findViewById(R.id.button4);
next=(Button)findViewById(R.id.next);
next.setEnabled(false);
qq1.setEnabled(false);
qq2.setEnabled(false);
qq3.setEnabled(false);

op1.setEnabled(false);
op2.setEnabled(false);
op3.setEnabled(false);
op4.setEnabled(false);

public void startu(View view) {


op1.setEnabled(true);
op2.setEnabled(true);
op3.setEnabled(true);
op4.setEnabled(true);
qq1.performClick();
timer= new CountDownTimer(30000, 1000) {

public void onTick(long millisUntilFinished) {


gg.setText("seconds remaining: " + millisUntilFinished /
1000);

public void onFinish() {


//m1.start();
gg.setText("Time Over!");
next.setEnabled(false);
op1.setChecked(false);
op2.setChecked(false);
op3.setChecked(false);
op4.setChecked(false);
op1.setEnabled(false);
op2.setEnabled(false);
op3.setEnabled(false);
op4.setEnabled(false);
score.setText("Your Score: "+q2o+"/3");
}
}.start();
startu2.setEnabled(false);
next.setEnabled(true);
}

public void q1(View view) {


question.setText("Who is the only bowler to take 4 wickets in 4 balls?
");
op1.setText("ASHISH NEHRA");
op2.setText("WASIM AKRAM");
op3.setText("LASITH MALINGA");
op4.setText("ANIL KUMBLE");

public void q2(View view) {


question.setText("WHAT IS INDIA'S FINAL SCORE IN THE 1983 WORLD CUP?");
op1.setText("175");
op2.setText("183");
op3.setText("245");
op4.setText("196");

public void q3(View view) {


question.setText("WHAT IS THE RULE OF DECIDING THE RESULT IN A
DISRUPTED CRICKET MATCH DUE TO RAIN OR LOW LIGHT?");
op1.setText("DUCKWORTH-LEWIS STERN METHOD");
op2.setText("ASHISH LEWIS METHOD");
op3.setText("NASSER HUSSAIN RULE");
op4.setText("VJD RULE");
}

public void pras(View view) {


q1o++;
switch(q1o)
{
case 1:
if(op1.isChecked())
{
qq1.setBackgroundColor(Color.parseColor("#800000"));
}
if(op2.isChecked())
{
qq1.setBackgroundColor(Color.parseColor("#800000"));
}
if(op3.isChecked())
{
qq1.setBackgroundColor(Color.parseColor("#4d7531"));
q2o++;
}
if(op4.isChecked())
{
qq1.setBackgroundColor(Color.parseColor("#800000"));
}
qq2.performClick();
op1.setChecked(false);
op2.setChecked(false);
op3.setChecked(false);
op4.setChecked(false);
break;
case 2:

if(op1.isChecked())
{
qq2.setBackgroundColor(Color.parseColor("#800000"));
}
if(op2.isChecked())
{
qq2.setBackgroundColor(Color.parseColor("#4d7531"));
q2o++;
}
if(op3.isChecked())
{
qq2.setBackgroundColor(Color.parseColor("#800000"));
}
if(op4.isChecked())
{
qq2.setBackgroundColor(Color.parseColor("#800000"));
}
qq3.performClick();
next.setText("Finish");
op1.setChecked(false);
op2.setChecked(false);
op3.setChecked(false);
op4.setChecked(false);

break;
case 3:
if(op1.isChecked())
{
qq3.setBackgroundColor(Color.parseColor("#4d7531"));
q2o++;
}
if(op2.isChecked())
{

qq3.setBackgroundColor(Color.parseColor("#800000"));
}
if(op3.isChecked())
{
qq3.setBackgroundColor(Color.parseColor("#800000"));
}
if(op4.isChecked())
{
qq3.setBackgroundColor(Color.parseColor("#800000"));
}
next.setEnabled(false);
op1.setChecked(false);
op2.setChecked(false);
op3.setChecked(false);
op4.setChecked(false);
op1.setEnabled(false);
op2.setEnabled(false);
op3.setEnabled(false);
op4.setEnabled(false);
score.setText("Your Score: "+q2o+"/3");
timer.cancel();
break;

default:

}
}
RESULT

The given screenshot shows the initial activity of the QUIZ app. You can see a
list view with the list of radio buttons, and upon clicking START, it will be
directed to the questions.
This image shows the first question which has 4 options amongst which one
option is right. You can see the timer running on the background. (The START
button has now been disabled)

This image shows the second question .A green light indicates that the first
question has been answered correctly by the user.
.
Image shows the third question. The first two questions have been marked
wrong which has been indicated by the two red marks.

You might also like