Giter Club home page Giter Club logo

space-trivia's Introduction

Space-Trivia

An open-source space trivia app for Android.

Written by Dan Ruscoe (http://ruscoe.org/)

Requirements

Usage

Trivia categories and questions can be found in CSV files within the /res/raw directory.

Installing the OpenCSV Library in Eclipse

  • Download OpenCSV 2.3
  • Extract the archive and locate the file named opencsv-2.3.jar, in the 'deploy' directory.
  • Open the Space Trivia project in Eclipse.
  • Create a new folder named libs in the root of the Space Trivia project.
  • Copy opencsv-2.3.jar into the newly created libs folder.
  • From the main menu, select Project then Clean... and clean the project.

Adding Categories and Questions

Categories and questions are contained in .csv files. To edit the files:

  • In the Space Trivia project, navigate to the res/raw directory.

  • To add a new question to an existing category, open the .csv file named after that category and add a new line. See Question CSV Data Format.

  • To add a new category, open categories_data.csv and add a new line. See Category CSV Data Format.

  • To add questions for a new category:

    • Create a new file in the res/raw directory. The naming convention is: questions_my_category.csv
    • Populate the new file with CSV-formatted question data. See Question CSV Data Format.
    • Open src/org/ruscoe/spacetrivia/dao/TriviaDAO.java.
    • Locate the onCreate method and look for the following code:
    importQuestionsData(db, R.raw.questions_space_exploration);
    importQuestionsData(db, R.raw.questions_earth_moon);
    importQuestionsData(db, R.raw.questions_solar_system);
    • Add a line below that section of code, similar to this:
    importQuestionsData(db, R.raw.questions_my_category);

    Note that the resource ID (R.raw.*) must match the name of the question data file you created, minus the .csv extension.

    • On your device, clear the application data (or uninstall) and rebuild the application from Eclipse.
    • Your new category / question data should now appear in the application.

Category CSV Data Format

1, "Space Exploration"

Indexes:

  1. The unique ID of the category.
  2. The name of the category.

Question CSV Data Format

1,1,"The first manned Moon landing occurred in July of which year?","The first manned Moon landing occurred on July 20th, 1969 during the Apollo 11 mission.",1969,1959,1979

Indexes

  1. The ID of category the question belongs to. Must match an ID in the categories CSV file.
  2. The unique ID of the question.
  3. The question text.
  4. The long answer text, shown after the user selects an answer.
  5. The correct answer option.
  6. Incorrect answer option #1.
  7. Incorrect answer option #2.

License

Released under the MIT License.

Sounds

UI sounds courtesy of GUI Sound Effects.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.