Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using Android Studio in Java: Write an application that gives the user a quiz. The main learning outcome of this phase is understanding fragments ,

Using Android Studio in Java:

Write an application that gives the user a quiz. The main learning outcome of this phase is understanding fragments, so your Second Activity must be implemented using them. You will also learn the basics of file I/O in Java and RecyclerViews. Please include comments in program explaining what everything does.

You will have three Activities, as follows:

  1. The initial screen requests your name and shows a list of possible quizzes. Here is how it works:
  1. Look for files named Quiz*.txt. The format of the data in these files is described below, but the first line is the topic. Read each file and put all of the quizzes in a list.
  2. Show the topics in a RecyclerView.
  3. The user picks a quiz and presses Next. This brings up the second activity, with the first question.

  1. This Activity runs the quiz and has the questions. These are multiple-choice, as shown in the screen mock-up below. Its operation is as follows:
  1. The question and its four answers are shown in five TextViews.
  2. When the user touches one of the answers, change the background color to light blue and the background of any previously-selected answer to white.
  3. To confirm the answer, the user must press the Answer button. This button is in a Fragment so that, when it is pressed, you can replace it with a new Fragment that either congratulates the user for a correct answer or tells them which answer is correct.
  4. Pressing the new fragment brings up a new question and puts back the Answer button fragment.
  5. Continue until all questions have been answered.

  1. Once all of the questions have been answered, bring up this Activity to show the persons name, the name of the quiz, and their score as, say, 9/10. That is, 9 right out of 10 questions. Return to the first Activity and show the list of quizzes.

Quiz file format:

  1. Line 1: the quiz topic, such as Android Sensors.
  2. Lines 2-6 and subsequent groups of 5 lines are the actual questions, as follows:
  1. The question itself, such as, Which sensor measures air pressure?
  2. Four answers, one per line, with the correct answer preceded by an asterisk:
  1. Hygrometer
  2. Thermometer
  3. *Barometer
  4. Parking meter

Quiz1Data.txt:

Android Sensors

Which sensor measures air pressure?

Hygrometer

Thermometer

*Barometer

Parking meter

Which class can be used to determine available sensors on a device?

*SensorManager

Sensor

SensorDevices

None of the above

Quiz2Data.txt

Android File I/O

Which object can be used to read a text file?

Reader

*Scanner

File

Keyboard

Which class has information about a file or directory?

*File

FileSystem

/dev

None of the above

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Development For Dummies

Authors: Allen G. Taylor

1st Edition

978-0764507526

More Books

Students also viewed these Databases questions