Skip to content

Modifying the App

ielmie edited this page Jul 23, 2020 · 13 revisions

CHANGING THE TITLE OF THE GAME:

In MainActivity.java, on line 16, you will find the title String:

String title = "10 Question Quiz";

You can change it to anything you please so long as you surround your title with double quotation marks ex: "My Quiz".

ADDING MORE QUESTIONS:

Step 1

Questions need to be added to the triviaQuestions.txt file in the following format:

Make sure you don't leave any blank lines between questions. Each question and answer must have its own line.

Ex:

Step 2

In Question.java, on line 22, you will find the following code:

final static int numberOfQuestions = 30;

This variable must be changed each time you add questions to reflect the new total number of Questions in the file. Hint: the number of questions is equal to the number of lines with text in them in the .txt file divided by 5

CREATING YOUR OWN DATABANK OF QUESTIONS:

Create a new .txt file and make sure it is encoded in UTF-8. Make sure to place it in the assets folder.

Write multiple-choice questions following the format explained in step 1 of the section ADDING MORE QUESTIONS.

NOTE: Make sure the file has at least as many questions as the number of questions asked.

In Question.java, on line 22, you will find the following code:

final static int numberOfQuestions = 30;

Change the number to reflect the total amount of questions in your new file

in MainActivity.java, on line 18, you will find the string representing the filename:

   String fileName = "triviaQuestions.txt";

Change this to be the name of your new .txt file. ex: "HistoryReviewTrivia.txt"

CHANGING THE NUMBER OF QUESTIONS ASKED BY THE GAME:

In MainActivity.java, on line 17, you will find the number of questions asked integer:

int numberOfQuestionsAsked = 10;

You can change it to anything you please so long as it's a whole number that is smaller than the total amount of questions in your triviaQuestions.txt file.

FEATURES THAT CAN BE EASILY ADDED:

Since, in MainActivity.java, on line 18, you will find the string representing the filename:

   String fileName = "triviaQuestions.txt";

You could create several files in various themes and add some sort of feature in MainActivity.java for the user to select a theme. It could be a button that when pressed cycles between the different themes by changing the variable fileName as well as its own text to something meaningful or a dropdown menu that does a similar thing in the background.

Clone this wiki locally