UNIT 5: APP INVENTOR 2 (LEARN TO MAKE YOUR OWN APP'S)
Make and Take Quiz - App Inventor 2 - Advanced tutorial
You can customize the Presidents Quiz app (ealier tutorial) to build any quiz, but it is only the programmer who can modify the questions and answers. There is no way for parents, teachers, or other app users to create their own quizzes or change the quiz questions (unless they too want to learn how to use App Inventor!).
In this tutorial, you’ll build a MakeQuiz app that lets a “teacher” create quizzes using an input form. The quiz questions and answers will be stored in a web database so that “students” can access a separate TakeQuiz app and take the test. While building these two apps, you’ll make yet another significant conceptual leap: learning how to create apps with user-generated data that is shared across apps and users.
Parents can create fun trivia apps for their children during a long road trip, grade-school teachers can build “Math Blaster” quizzes, and college students can build quizzes to help their study groups prepare for a final.
This tutorial builds on the Presidents Quiz tutorial, so if you haven’t completed that app, you should do so
before continuing on here. You’ll design two apps, MakeQuiz for the teacher and TakeQuiz for the student,
which will appear similar to the Presidents Quiz.
Here are the behaviors you’ll code for the first app, MakeQuiz:
• The user types questions and answers in an input form.
• The question-answer pairs are displayed.
• The quiz questions and answers are stored in a web database.
The second app you’ll create, TakeQuiz, will work similarly to the Presidents Quiz app you’ve already built. In fact, you’ll use the Presidents Quiz app as a starting point. TakeQuiz will differ in that the questions asked will be those that were entered into the database via MakeQuiz.
What You’ll Learn
The Presidents Quiz was an example of an app with static data: no matter how many times you take the quiz, the questions are always the same because they are hardcoded into the app; that is, the questions and answers are part of the blocks. News apps, blogs, and social networking apps such as Facebook and Twitter work with dynamic data, meaning the data can change over time. Often, this dynamic information is user generated—the app allows users to enter, modify, and share information. With MakeQuiz and TakeQuiz, you’ll learn how to build an app that handles shared, user-generated data.
If you completed the Xylophone app turoail, you’ve already been introduced to dynamic lists; in that app, the musical notes the user plays are recorded in lists. Apps with such user-generated data are more complex, and the blocks are more abstract because they don’t rely on predefined, static data. You define list variables, but you define them without specific items. As you program your app, you need to envision the lists being populated with data provided by the end user. This tutorial covers the following App Inventor concepts:
• Input forms for allowing the user to enter information.
• Using an indexed list along with for each to display items from multiple lists.
• Persistent list data—MakeQuiz will save the quiz questions and answers in a web database,
and TakeQuiz will load them in from the same database.
• Data sharing—you’ll store the data in a web database by using the TinyWebDB component
(instead of the TinyDB component used in previous chapters).