+ All Categories
Home > Documents > Mobile Quiz-Rakhav,Balan,Krishnakanth1

Mobile Quiz-Rakhav,Balan,Krishnakanth1

Date post: 07-Apr-2017
Category:
Upload: rakhav-krishna-g
View: 122 times
Download: 0 times
Share this document with a friend
53
1 | Page MEPCO SCHLENK ENGINEERING COLLEGE, SIVAKASI (An Autonomous Institution) (Affliated to Anna University,Chennai) (Accrediated by NBA) MINI PROJECT REPORT (2015-2016) On MOBILE QUIZ ANDROID APPLICATION Submitted by G.RAKHAV KRISHNA(201406050) D.BALAN(201406009) V.KRISHNAKANTH(201406034) Of Department of Information Technology
Transcript

1 | P a g e

MEPCO SCHLENK ENGINEERING

COLLEGE, SIVAKASI

(An Autonomous Institution)

(Affliated to Anna University,Chennai)

(Accrediated by NBA)

MINI PROJECT REPORT (2015-2016)

On

MOBILE QUIZ ANDROID APPLICATION

Submitted by

G.RAKHAV KRISHNA(201406050)

D.BALAN(201406009)

V.KRISHNAKANTH(201406034)

Of

Department of Information Technology

2 | P a g e

BONAFIDE CERTIFICATE

It is certified that this mini-project work titled as MOBILE QUIZ

ANDROID APPLICATION done by G.Rakhav krishna, D.Balan and

V.Krishnakanth for their sincere work in the Operating systems

Laboratory(13IT453) during the fourth semester of the academic year 2015-2016.

------------------ ---------------- Dr.S.RAJESH Dr. T.REVATHI

Staff-in-Charge Sr.Prof. and Head

IT Department

------------------

MRS.N.MALATHY

Project Guide

3 | P a g e

ACKNOWLEDGEMENT

We express our deep sense of gratitude to Dr.T.Revathi,

M.E.,Ph.D.,Professor& Head of the Department who has been our great source of

inspiration.

We express our deep sense of gratitude towards Dr.S.Rajesh M.E.,Ph.D.,

Associate Professor, of our department for spending his precious time with us.

We extend our gratitude to Mrs.N.Malathy M.E., Assistant Professor who

has been our great source of inspiration.

We also offer our sincere thanks to our Dr.B.D.Deepak M.E., Assistant

Professor for having helped us in every stage of our project.

Finally but immensely, We would like to thank our parents for their blessings

and friends for their moral support without whom this project would not have been

possible.

4 | P a g e

Tables Of Content

S.No Title Page No

1.

Abstract

5

2. Problem statement 6

3.

3.1

3.2

System Requirements

Hardware Configuration

Software Configuration

7

7

7

4. Implementation Methodology 8

5. Android Eclipse 9

6. Code snippet 17

7. Snapshot 42

8. Conclusion 52

9. References 53

5 | P a g e

ABSTRACT:

Now-a-days most of us use mobile phones in our day-to-day life, but that

should be useful for betterment of our life. In order to survive in this competitive

world we have to develop General Knowledge. So to inculcate this practice, it is

proposed to develop an android application “MOBILE QUIZ “ . This app will contain

questions about current affairs. This app will useful for everyone who feels lazy to

open their books to develop their knowledge. As this app is available in the mobile

phone, so it can be used anytime and anywhere. This app will have 10 questions

and 3 options for each question. User can select the optimal answer from the

options. At the end of each question, answer will be displayed to the user. User will

be credited 1 point for each correct answer. No negative marking for wrong

answers. Total score will be displayed at the end of the quiz. Hereby we hope that

this app will sharpen your brain.

6 | P a g e

Problem Statement:

This app will useful for everyone who feels lazy to open their books to develop their knowledge. As this app is available in the mobile phone, so it can be used anytime and anywhere. Now-a-days most of us use mobile phones in our day-to-day life, but that should be useful for betterment of our life. In order to survive in this competitive world we have to develop General Knowledge.

7 | P a g e

System Requirement:

Hardware Requirements:

Processor: CORE I5(fifth generation)

RAM: 4 GB

Hard disk: 1 TB

Software requirements:

Adt-bundle-windows-x86-20131030.

Android Virtual Device Manager.

Eclipse Software.

8 | P a g e

Implementation Methodology:

We have used an activity called QuizActivity.java. Inside that we have

included the main files. Then we have created a layout. In that layout main.xml is

the layout that we have used for QuizActivity.java. It consists of a single button

which on being pressed moves to the next activity. With the help of Android

manifest file, we can create the next java file for the next activity. The next

activity is SubActivity1.java whose xml file is Activity:sub1.xml and goes on.

In that xml file ,we display the question and get the answer from user using radio

buttons.This continues all the forthcoming xml files. On clicking the submit

button, the total score will be displayed to the user .

9 | P a g e

ANDROID ECLIPSE:

10 | P a g e

11 | P a g e

12 | P a g e

13 | P a g e

14 | P a g e

15 | P a g e

16 | P a g e

17 | P a g e

CODE SNIPPET:

ANDROID MANIFEST FILE

<?xml version="1.0" encoding="UTF-8"?>

<manifest android:versionName="1.0" android:versionCode="1" package="com.example"

xmlns:android="http://schemas.android.com/apk/res/android"><uses-sdk

android:minSdkVersion="10"/><application android:label="@string/app_name"

android:icon="@drawable/ic_launcher"><activity android:label="@string/app_name"

android:name=".QuizActivity"><intent-filter><action

android:name="android.intent.action.MAIN"/><category

android:name="android.intent.category.LAUNCHER"/></intent-filter></activity><activity

android:name="subActivity1"/><activity android:name="SubActivity2"/><activity

android:name="SubActivity3"/><activity android:name="SubActivity4"/><activity

android:name="SubActivity5"/><activity android:name="SubActivity6"/><activity

android:name="SubActivity7"/><activity android:name="SubActivity8"/><activity

android:name="SubActivity9"/><activity android:name="SubActivity10"/><activity

android:name="SubActivity11"/></application></manifest>

Strings.xml

<?xml version="1.0" encoding="UTF-8"?>

<resources><string name="hello">Hello World, QuizActivity!</string><string

name="app_name">Quiz</string><string name="astro">QUIZ</string><string

name="china">China</string><string name="cuba">Cuba</string><string

name="japan">Japan</string><string name="next">Next</string><string

name="start">START</string><string name="jn">jawaharlal Nehru</string><string

name="pranab">pranab mukerjee</string><string name="rajendra">Rajendra

Prasad</string><string name="msdhoni">Mahendra Singh Dhoni</string><string

name="ricky">Ricky Ponting</string><string name="ganguly">Sourav

Ganguly</string><string name="govi">Govinda Raj</string><string name="krishna">Krishna

Kumar</string><string name="rakhav">Rakhav</string><string name="gobi">Gobi

Desert</string><string name="thar">Thar Desert</string><string name="sahara">Sahara

Desert</string><string name="brazil">Brazil</string><string

name="qatar">Qatar</string><string name="australia">Australia</string><string

name="total">Total</string><string name="exit">Exit</string><string

name="norway">Norway</string><string name="sweden">Sweden</string><string

name="spain">Spain</string><string name="thailand">Thailand</string><string

18 | P a g e

name="india">India</string><string name="srilanka">Srilanka</string><string

name="virat">Virat Kohli</string><string name="messi">Lionel Messi</string><string

name="nadal">Rafiel Nadal</string><string name="mumbai">Mumbai</string><string

name="chennai">Chennai</string><string name="kolkatta">Kolkatta</string></resources>

QuizActivity.java

package com.example;

import android.app.Activity;

import android.app.AlertDialog.Builder;

import android.os.Bundle;

import android.widget.RadioGroup;

import android.content.Context;

import android.content.Intent;

import android.database.Cursor;

import android.database.sqlite.SQLiteDatabase;

import android.os.Bundle;

import android.view.Menu;

import android.view.MenuItem;

import android.view.View;

import android.widget.Button;

import android.widget.RadioButton;

import android.widget.RadioGroup;

import android.widget.TextView;

import android.widget.Toast;

19 | P a g e

public class QuizActivity extends Activity {

public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.main);

Button button1 = (Button)findViewById(R.id.button1);

button1.setOnClickListener(new View.OnClickListener() {

public void onClick(View v) {

Intent were=new Intent(QuizActivity.this,subActivity1.class);

startActivity(were);

finish();

}

});

}

}

Main.xml

<?xml version="1.0" encoding="UTF-8"?>

-<RelativeLayout android:orientation="vertical" android:layout_height="fill_parent"

android:layout_width="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android">

<TextView android:layout_height="wrap_content" android:layout_width="wrap_content"

android:textAppearance="?android:attr/textAppearanceLarge" android:text="@string/astro"

android:layout_marginTop="136dp" android:layout_centerHorizontal="true"

android:layout_alignParentTop="true" android:id="@+id/textView1"/>

20 | P a g e

<Button android:layout_height="wrap_content" android:layout_width="wrap_content"

android:text="@string/start" android:layout_marginTop="71dp"

android:layout_centerHorizontal="true" android:id="@+id/button1" android:minWidth="150dp"

android:minHeight="60dip" android:layout_below="@+id/textView1"/>

</RelativeLayout>

SubActivity1.java

package com.example;

import android.app.Activity;

import android.content.Context;

import android.content.Intent;

import android.database.Cursor;

import android.database.sqlite.SQLiteDatabase;

import android.os.Bundle;

import android.view.View;

import android.widget.Button;

import android.widget.RadioButton;

import android.widget.RadioGroup;

import android.widget.TextView;

import android.widget.Toast;

public class subActivity1 extends Activity {

String nowstatus,status="saavu";

SQLiteDatabase db;

int le=0;

/** Called when the activity is first created. */

21 | P a g e

@Override

public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.sub1);

db=openOrCreateDatabase("StudentDB", Context.MODE_PRIVATE, null);

db.execSQL("CREATE TABLE IF NOT EXISTS question(question VARCHAR,k VARCHAR);");

db.execSQL("INSERT INTO question VALUES('WHO IS THE FIRST PRESIDENT OF INDIA ?','q11');");

// Bundle b = getIntent().getExtras();

// le=b.getInt("length");

final RadioGroup group;

final RadioButton button1;

final RadioButton button2;

final RadioButton button3;

final RadioButton button4;

Button button5;

String text=null;

StringBuffer buffer=new StringBuffer();

TextView tv=(TextView)findViewById(R.id.textView1);

Cursor c=db.rawQuery("SELECT * FROM question WHERE k='q11'", null);

if(c.moveToFirst())

{

text=c.getString(0);

}

tv.setText(text);

button1=(RadioButton)findViewById(R.id.radioButton1);

// button2=(RadioButton)findViewById(R.id.radioButton2);

22 | P a g e

button3=(RadioButton)findViewById(R.id.radioButton3);

button4=(RadioButton)findViewById(R.id.radioButton2);

button5=(Button)findViewById(R.id.button1);

button5.setOnClickListener(new View.OnClickListener() {

public void onClick(View v) {

if(button1.isChecked())

{

le++;

Toast.makeText(getApplicationContext(),"CORRECT",Toast.LENGTH_LONG).show();

}

// else if(button2.isChecked())

// {

// Toast.makeText(getApplicationContext(),"CORRECT",Toast.LENGTH_LONG).show();

// }

else if(button3.isChecked())

{

Toast.makeText(getApplicationContext(),"INCORRECT(ANSWER:RAJENDRA PRASAD)",Toast.LENGTH_LONG).show();

}

else if(button4.isChecked())

{

Toast.makeText(getApplicationContext(),"INCORRECT(ANSWER:RAJENDRA PRASAD)",Toast.LENGTH_LONG).show();

23 | P a g e

}

Intent were=new Intent(subActivity1.this,SubActivity2.class);

Bundle b = new Bundle();

b.putInt("length", le);

were.putExtras(b);

startActivity(were);

finish();

}

});

}

// TODO Auto-generated method stub

}

Sub1.xml

<?xml version="1.0" encoding="UTF-8"?>

-<RelativeLayout android:orientation="vertical" android:layout_height="fill_parent"

android:layout_width="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android">

<TextView android:layout_height="wrap_content" android:layout_width="wrap_content"

android:textAppearance="?android:attr/textAppearanceLarge" android:layout_marginTop="18dp"

android:layout_centerHorizontal="true" android:layout_alignParentTop="true"

android:id="@+id/textView1"/>

24 | P a g e

-<RadioGroup android:layout_height="wrap_content" android:layout_width="wrap_content"

android:layout_centerHorizontal="true" android:id="@+id/radioGroup1"

android:layout_below="@+id/textView1">

<RadioButton android:layout_height="wrap_content" android:layout_width="wrap_content"

android:layout_marginTop="46dp" android:id="@+id/radioButton1" android:text="@string/rajendra"/>

<RadioButton android:layout_height="wrap_content" android:layout_width="wrap_content"

android:layout_marginTop="30dp" android:id="@+id/radioButton2" android:text="@string/jn"/>

<RadioButton android:layout_height="wrap_content" android:layout_width="wrap_content"

android:layout_marginTop="29dp" android:id="@+id/radioButton3" android:text="@string/pranab"/>

</RadioGroup>

<Button android:layout_height="wrap_content" android:layout_width="wrap_content"

android:id="@+id/button1" android:text="@string/next"

android:layout_toRightOf="@+id/radioGroup1" android:layout_marginLeft="14dp"

android:layout_marginBottom="57dp" android:layout_alignParentBottom="true"/>

</RelativeLayout>

SubActivity2.java

package com.example;

import android.app.Activity;

import android.content.Context;

import android.content.Intent;

25 | P a g e

import android.database.Cursor;

import android.database.sqlite.SQLiteDatabase;

import android.os.Bundle;

import android.view.View;

import android.widget.Button;

import android.widget.RadioButton;

import android.widget.RadioGroup;

import android.widget.TextView;

import android.widget.Toast;

public class SubActivity2 extends Activity {

String nowstatus,status="saavu";

SQLiteDatabase db;

int le;

/** Called when the activity is first created. */

@Override

public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.sub2);

db=openOrCreateDatabase("StudentDB", Context.MODE_PRIVATE, null);

Bundle b = getIntent().getExtras();

le=b.getInt("length");

final RadioGroup group;

final RadioButton button1;

final RadioButton button2;

final RadioButton button3;

final RadioButton button4;

Button button5;

26 | P a g e

String text=null;

StringBuffer buffer=new StringBuffer();

TextView tv=(TextView)findViewById(R.id.textView1);

Cursor c=db.rawQuery("SELECT * FROM question WHERE k='q3'", null);

if(c.moveToFirst())

{

text=c.getString(0);

}

tv.setText(text);

button1=(RadioButton)findViewById(R.id.radioButton1);

// button2=(RadioButton)findViewById(R.id.radioButton2);

button3=(RadioButton)findViewById(R.id.radioButton3);

button4=(RadioButton)findViewById(R.id.radioButton2);

button5=(Button)findViewById(R.id.button1);

button5.setOnClickListener(new View.OnClickListener() {

public void onClick(View v) {

if(button4.isChecked())

{

le++;

Toast.makeText(getApplicationContext(),"CORRECT",Toast.LENGTH_LONG).show();

}

// else if(button2.isChecked())

// {

// Toast.makeText(getApplicationContext(),"CORRECT",Toast.LENGTH_LONG).show();

27 | P a g e

// }

else if(button1.isChecked())

{

Toast.makeText(getApplicationContext(),"INCORRECT(ANSWER:MAHENDRA SINGH DHONI)",Toast.LENGTH_LONG).show();

}

else if(button3.isChecked())

{

Toast.makeText(getApplicationContext(),"INCORRECT(ANSWER:MAHENDRA SINGH DHONI)",Toast.LENGTH_LONG).show();

}

Intent were=new Intent(SubActivity2.this,SubActivity3.class);

Bundle b = new Bundle();

b.putInt("length", le);

were.putExtras(b);

startActivity(were);

finish();

}

});

// TODO Auto-generated method stub

}

}

28 | P a g e

Sub2.xml

<?xml version="1.0" encoding="UTF-8"?>

<RelativeLayout android:orientation="vertical" android:layout_height="fill_parent"

android:layout_width="fill_parent"

xmlns:android="http://schemas.android.com/apk/res/android"><TextView

android:layout_height="wrap_content" android:layout_width="wrap_content"

android:textAppearance="?android:attr/textAppearanceLarge"

android:layout_marginTop="18dp" android:layout_centerHorizontal="true"

android:layout_alignParentTop="true" android:id="@+id/textView1"/><RadioGroup

android:layout_height="wrap_content" android:layout_width="wrap_content"

android:layout_centerHorizontal="true" android:id="@+id/radioGroup1"

android:layout_below="@+id/textView1"><RadioButton

android:layout_height="wrap_content" android:layout_width="wrap_content"

android:layout_marginTop="46dp" android:id="@+id/radioButton1"

android:text="@string/ganguly"/><RadioButton android:layout_height="wrap_content"

android:layout_width="wrap_content" android:layout_marginTop="30dp"

android:id="@+id/radioButton2" android:text="@string/msdhoni"/><RadioButton

android:layout_height="wrap_content" android:layout_width="wrap_content"

android:layout_marginTop="29dp" android:id="@+id/radioButton3"

android:text="@string/ricky"/></RadioGroup><Button android:layout_height="wrap_content"

android:layout_width="wrap_content" android:id="@+id/button1"

android:text="@string/next" android:layout_toRightOf="@+id/radioGroup1"

android:layout_marginLeft="14dp" android:layout_marginBottom="57dp"

android:layout_alignParentBottom="true"/></RelativeLayout>

SubActivity3.java

package com.example;

import android.app.Activity;

import android.content.Context;

import android.content.Intent;

import android.database.Cursor;

import android.database.sqlite.SQLiteDatabase;

import android.os.Bundle;

import android.view.View;

29 | P a g e

import android.widget.Button;

import android.widget.RadioButton;

import android.widget.RadioGroup;

import android.widget.TextView;

import android.widget.Toast;

public class SubActivity3 extends Activity {

String nowstatus,status="saavu";

SQLiteDatabase db;

int le;

/** Called when the activity is first created. */

@Override

public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.sub3);

db=openOrCreateDatabase("StudentDB", Context.MODE_PRIVATE, null);

Bundle b = getIntent().getExtras();

le=b.getInt("length");

final RadioGroup group;

final RadioButton button1;

final RadioButton button2;

final RadioButton button3;

final RadioButton button4;

Button button5;

String text=null;

StringBuffer buffer=new StringBuffer();

TextView tv=(TextView)findViewById(R.id.textView1);

30 | P a g e

Cursor c=db.rawQuery("SELECT * FROM question WHERE k='q4'", null);

if(c.moveToFirst())

{

buffer.append("Rollno: "+c.getString(0)+"\n");

text=c.getString(0);

// showMessage("Student Details", buffer.toString());

}

// showMessage("Student Details", "hai");

tv.setText(text);

button1=(RadioButton)findViewById(R.id.radioButton1);

// button2=(RadioButton)findViewById(R.id.radioButton2);

button3=(RadioButton)findViewById(R.id.radioButton3);

button4=(RadioButton)findViewById(R.id.radioButton2);

button5=(Button)findViewById(R.id.button1);

button5.setOnClickListener(new View.OnClickListener() {

public void onClick(View v) {

if(button1.isChecked())

{

le++;

Toast.makeText(getApplicationContext(),"CORRECT",Toast.LENGTH_LONG).show();

}

// else if(button2.isChecked())

// {

//

Toast.makeText(getApplicationContext(),"CORRECT",Toast.LENGTH_LONG).show();

31 | P a g e

// }

else if(button3.isChecked())

{

Toast.makeText(getApplicationContext(),"INCORRECT(ANSWER:GOVINDHA

RAJ)",Toast.LENGTH_LONG).show();

}

else if(button4.isChecked())

{

Toast.makeText(getApplicationContext(),"INCORRECT(ANSWER:GOVINDHA

RAJ)",Toast.LENGTH_LONG).show();

}

Intent were=new

Intent(SubActivity3.this,SubActivity4.class);

Bundle b = new Bundle();

b.putInt("length", le);

were.putExtras(b);

startActivity(were);

finish();

}

});

// TODO Auto-generated method stub

}

}

32 | P a g e

Sub3.xml

<?xml version="1.0" encoding="UTF-8"?>

-<RelativeLayout android:orientation="vertical" android:layout_height="fill_parent" android:layout_width="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android">

<TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:textAppearance="?android:attr/textAppearanceLarge" android:layout_marginTop="18dp" android:layout_centerHorizontal="true" android:layout_alignParentTop="true" android:id="@+id/textView1"/>

-<RadioGroup android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_centerHorizontal="true" android:id="@+id/radioGroup1" android:layout_below="@+id/textView1">

<RadioButton android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_marginTop="46dp" android:id="@+id/radioButton1" android:text="@string/govi"/>

<RadioButton android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_marginTop="30dp" android:id="@+id/radioButton2" android:text="@string/krishna"/>

<RadioButton android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_marginTop="29dp" android:id="@+id/radioButton3" android:text="@string/rakhav"/>

</RadioGroup>

<Button android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/button1" android:text="@string/next" android:layout_toRightOf="@+id/radioGroup1" android:layout_marginLeft="14dp" android:layout_marginBottom="57dp" android:layout_alignParentBottom="true"/>

33 | P a g e

</RelativeLayout>

SubActivity4.java

package com.example;

import android.app.Activity;

import android.content.Context;

import android.content.Intent;

import android.database.Cursor;

import android.database.sqlite.SQLiteDatabase;

import android.os.Bundle;

import android.view.View;

import android.widget.Button;

import android.widget.RadioButton;

import android.widget.RadioGroup;

import android.widget.TextView;

import android.widget.Toast;

public class SubActivity4 extends Activity {

String nowstatus,status="saavu";

SQLiteDatabase db;

int le;

/** Called when the activity is first created. */

@Override

public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.sub4);

db=openOrCreateDatabase("StudentDB", Context.MODE_PRIVATE, null);

34 | P a g e

Bundle b = getIntent().getExtras();

le=b.getInt("length");

final RadioGroup group;

final RadioButton button1;

final RadioButton button2;

final RadioButton button3;

final RadioButton button4;

Button button5;

String text=null;

StringBuffer buffer=new StringBuffer();

TextView tv=(TextView)findViewById(R.id.textView1);

Cursor c=db.rawQuery("SELECT * FROM question WHERE k='q5'", null);

if(c.moveToFirst())

{

buffer.append("Rollno: "+c.getString(0)+"\n");

text=c.getString(0);

// showMessage("Student Details", buffer.toString());

}

// showMessage("Student Details", "hai");

tv.setText(text);

button1=(RadioButton)findViewById(R.id.radioButton1);

// button2=(RadioButton)findViewById(R.id.radioButton2);

button3=(RadioButton)findViewById(R.id.radioButton3);

button4=(RadioButton)findViewById(R.id.radioButton2);

button5=(Button)findViewById(R.id.button1);

button5.setOnClickListener(new View.OnClickListener() {

35 | P a g e

public void onClick(View v) {

if(button3.isChecked())

{

le++;

Toast.makeText(getApplicationContext(),"CORRECT",Toast.LENGTH_LONG).show();

}

// else if(button2.isChecked())

// {

//

Toast.makeText(getApplicationContext(),"CORRECT",Toast.LENGTH_LONG).show();

// }

else if(button4.isChecked())

{

Toast.makeText(getApplicationContext(),"INCORRECT(ANSWER:GOBI

DESERT)",Toast.LENGTH_LONG).show();

}

else if(button1.isChecked())

{

Toast.makeText(getApplicationContext(),"INCORRECT(ANSWER:GOBI

DESERT)",Toast.LENGTH_LONG).show();

}

Intent were=new

Intent(SubActivity4.this,SubActivity5.class);

Bundle b = new Bundle();

b.putInt("length", le);

36 | P a g e

were.putExtras(b);

startActivity(were);

finish();

}

});

// TODO Auto-generated method stub

}

}

Sub4.xml

<?xml version="1.0" encoding="UTF-8"?>

-<RelativeLayout android:orientation="vertical" android:layout_height="fill_parent"

android:layout_width="fill_parent"

xmlns:android="http://schemas.android.com/apk/res/android">

<TextView android:layout_height="wrap_content" android:layout_width="wrap_content"

android:textAppearance="?android:attr/textAppearanceLarge"

android:layout_marginTop="18dp" android:layout_centerHorizontal="true"

android:layout_alignParentTop="true" android:id="@+id/textView1"/>

-<RadioGroup android:layout_height="wrap_content" android:layout_width="wrap_content"

android:layout_centerHorizontal="true" android:id="@+id/radioGroup1"

android:layout_below="@+id/textView1">

<RadioButton android:layout_height="wrap_content" android:layout_width="wrap_content"

android:layout_marginTop="46dp" android:id="@+id/radioButton1"

android:text="@string/thar"/>

37 | P a g e

<RadioButton android:layout_height="wrap_content" android:layout_width="wrap_content"

android:layout_marginTop="30dp" android:id="@+id/radioButton2"

android:text="@string/sahara"/>

<RadioButton android:layout_height="wrap_content" android:layout_width="wrap_content"

android:layout_marginTop="29dp" android:id="@+id/radioButton3"

android:text="@string/gobi"/>

</RadioGroup>

<Button android:layout_height="wrap_content" android:layout_width="wrap_content"

android:id="@+id/button1" android:text="@string/next"

android:layout_toRightOf="@+id/radioGroup1" android:layout_marginLeft="14dp"

android:layout_marginBottom="57dp" android:layout_alignParentBottom="true"/>

</RelativeLayout>

SubActivity5.java

package com.example;

import android.app.Activity;

import android.content.Context;

import android.content.Intent;

import android.database.Cursor;

import android.database.sqlite.SQLiteDatabase;

import android.os.Bundle;

import android.view.View;

import android.widget.Button;

import android.widget.RadioButton;

import android.widget.RadioGroup;

import android.widget.TextView;

38 | P a g e

import android.widget.Toast;

public class SubActivity5 extends Activity {

String nowstatus,status="saavu";

SQLiteDatabase db;

int le;

/** Called when the activity is first created. */

@Override

public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.sub5);

db=openOrCreateDatabase("StudentDB", Context.MODE_PRIVATE, null);

Bundle b = getIntent().getExtras();

le=b.getInt("length");

final RadioGroup group;

final RadioButton button1;

final RadioButton button2;

final RadioButton button3;

final RadioButton button4;

Button button5;

String text=null;

StringBuffer buffer=new StringBuffer();

TextView tv=(TextView)findViewById(R.id.textView1);

Cursor c=db.rawQuery("SELECT * FROM question WHERE k='q6'", null);

if(c.moveToFirst())

{

buffer.append("Rollno: "+c.getString(0)+"\n");

39 | P a g e

text=c.getString(0);

// showMessage("Student Details", buffer.toString());

}

// showMessage("Student Details", "hai");

tv.setText(text);

button1=(RadioButton)findViewById(R.id.radioButton1);

// button2=(RadioButton)findViewById(R.id.radioButton2);

button3=(RadioButton)findViewById(R.id.radioButton3);

button4=(RadioButton)findViewById(R.id.radioButton2);

button5=(Button)findViewById(R.id.button1);

button5.setOnClickListener(new View.OnClickListener() {

public void onClick(View v) {

if(button4.isChecked())

{

le++;

Toast.makeText(getApplicationContext(),"CORRECT",Toast.LENGTH_LONG).show();

}

// else if(button2.isChecked())

// {

//

Toast.makeText(getApplicationContext(),"CORRECT",Toast.LENGTH_LONG).show();

// }

else if(button1.isChecked())

{

40 | P a g e

Toast.makeText(getApplicationContext(),"INCORRECT(ANSWER:BRAZIL)",Toast.L

ENGTH_LONG).show();

}

else if(button3.isChecked())

{

Toast.makeText(getApplicationContext(),"INCORRECT(ANSWER:BRAZIL)",Toast.L

ENGTH_LONG).show();

}

//Toast.makeText(getApplicationContext(),"TOTAL SCORE

IS"+le,Toast.LENGTH_LONG).show();

Intent were=new

Intent(SubActivity5.this,SubActivity6.class);

Bundle b = new Bundle();

b.putInt("length", le);

were.putExtras(b);

startActivity(were);

finish();

}

});

// TODO Auto-generated method stub

}

}

41 | P a g e

Sub5.xml

<?xml version="1.0" encoding="UTF-8"?>

<RelativeLayout android:orientation="vertical" android:layout_height="fill_parent"

android:layout_width="fill_parent"

xmlns:android="http://schemas.android.com/apk/res/android"><TextView

android:layout_height="wrap_content" android:layout_width="wrap_content"

android:textAppearance="?android:attr/textAppearanceLarge"

android:layout_marginTop="18dp" android:layout_centerHorizontal="true"

android:layout_alignParentTop="true" android:id="@+id/textView1"/><RadioGroup

android:layout_height="wrap_content" android:layout_width="wrap_content"

android:layout_centerHorizontal="true" android:id="@+id/radioGroup1"

android:layout_below="@+id/textView1"><RadioButton

android:layout_height="wrap_content" android:layout_width="wrap_content"

android:layout_marginTop="46dp" android:id="@+id/radioButton1"

android:text="@string/qatar"/><RadioButton android:layout_height="wrap_content"

android:layout_width="wrap_content" android:layout_marginTop="30dp"

android:id="@+id/radioButton2" android:text="@string/brazil"/><RadioButton

android:layout_height="wrap_content" android:layout_width="wrap_content"

android:layout_marginTop="29dp" android:id="@+id/radioButton3"

android:text="@string/australia"/></RadioGroup><Button

android:layout_height="wrap_content" android:layout_width="wrap_content"

android:id="@+id/button1" android:text="@string/next"

android:layout_toRightOf="@+id/radioGroup1" android:layout_marginLeft="14dp"

android:layout_marginBottom="57dp"

android:layout_alignParentBottom="true"/></RelativeLayout>

42 | P a g e

SnapShots:

43 | P a g e

44 | P a g e

45 | P a g e

46 | P a g e

47 | P a g e

48 | P a g e

49 | P a g e

50 | P a g e

51 | P a g e

52 | P a g e

Conclusion:

Thus we have used Eclipse software version juno to create this

android app. This app will useful for everyone who feels lazy to open their books to

develop their knowledge. As this app is available in the mobile phone, so it can be

used anytime and anywhere. Now-a-days most of us use mobile phones in our day-

to-day life, but that should be useful for betterment of our life. In order to survive

in this competitive world we have to develop General Knowledge. Hereby we hope

that this app will sharpen your brain.

53 | P a g e

REFERENCES:

1. http://androidhive.com/tutorials.

2. www.androidtutorialpoint.com.

3. http://blog.teamtreehouse.com/beginners-guide-location-android


Recommended