*** Update! See: RefSignals: A quiz app built using App Inventor - how to stop repeated questions for an improved version of this app! ***
I've been going on quite a lot about Google's App Inventor for Android to anybody who will listen recently. An example application I show them is one I built as a result of a conversation I had with my friend Georgina Parsons while we were sat in an ice rink in Gothenburg, Sweden watching a great match between the Frölunda Indians (the local team) and HV71. Ice hockey is a shared interest of ours but normally we attend matches in England so following proceedings in Swedish could be tricky. Fortunately the referees have a series of standard signals they make to indicate which penalties they are calling and our conversation turned to how it would be great to have a mobile app to help us learn those signals.
At the time (back in October 2010) I was just starting to look at App Inventor and thought this would be a great use case. One Friday evening I set about building an app that would help you learn the signals by presenting the user with a picture and three possibilities as to which penalty the referee was calling. One of these would of course be correct then there would be two different wrong answers (obvious but the logic to do this was a bit tricky at first!). It would ask ten questions and keep a score. A few hours later I had a fully working app and thanks to Georgina's help testing it I got rid of the bugs and produced the app we spoke of without writing a single line of code.
The images for the various penalties all came from the wonderful Wikimedia Commons, so I uploaded each of these (about twenty five in total) and made two lists in the blocks editor, one for the list of pictures and another as a list of penalty names. As well as the image there are also five buttons on the screen, but not all of them will be visible at one time. When the app starts up a bit of introductory text is displayed and a button marked Play! is displayed. This button is relabelled later on as the Next button. The NextBtn.Click block contains the logic that is run when this button is clicked. On first run the label is changed and information labels hidden. The app will then ask questions and increment a counter until that counter hits eleven. At this point the app stops asking questions and the score is displayed. Between each question is a feedback screen to let the user know if they answered the question correctly, if not they are told the right answer.
During questioning the penalty is actually picked by a call to the pickPenalty procedure which sets a global variable indicating the penalty the question is about (which also returned to use as the index number to pick the right picture) and sets a global variable to set which button will have the correct answer. The generateButtonText procedure does the important job of generating text to go on each of the three answer buttons. It contains logic to insert the correct answer in the right place and then generate two wrong answers that are different from each other and the correct answer. When the user presses an answer button this is checked with the checkAnswer procedure which also generates the feedback screen. The logic behind the app is slightly complicated as I have two lists I need to use, one for the text descriptions and one for the representative images. This means I need to extract items from them using an index numbers rather than just checking for the presence of values in lists.
Even though the app relates to ice hockey there is no reason why people couldn't take the app and adapt it to their needs. How about an app that tests your knowledge of road signs? Maybe an app that helps you gain workplace knowledge? A fun revision tool for your students? The app does not push the boundaries of what App Inventor is capable of but instead shows its usefulness in creating an app for a fairly specialised purpose and it is something lots of people could do with less of a learning curve than traditional programming. The only real problem so far is the files it generates to install on the phone are rather large, so hopefully this will be addressed in future releases of App Inventor.
At the end of this post is the source code of the app. You can download this ZIP file and import it into your App Inventor account by making sure you are in the My Projects section, clicking More Actions and Upload Source. You will then have the project in your workspace and you can experiment and adapt it to heart's content. If you just want to play the app as it is the installer (APK) file is also attached. To install it you will need to Settings → Applications on your phone and ensure that “Unknown sources” is ticked (you can untick it after installation). Open up this page in your phone's browser and follow the link for the APK at the end of this post. There may be errors and imperfections so feel free to improve it, adapt it to your needs and share your experiences in the comments.
PS Don't forget, if you are a Facebook user you can now follow this site there simply by visiting the greenhughes.com page and clicking Like.
Re: source code
Hey,
I'm trying to load your program into appinventor, but I can't for the life of me find the right file to select when I go my projects-->more actions-->upload. I keep getting an error saying all of the files in your .zip (which I unzipped) aren't project save files. Any ideas? And PS this is amazing, and I'd like to thank you for allowing me to borrow your source code. I'm trying to adapt it for my classmates to use as a quiz for prepping for the national paramedic exam. Thanks!
Re: source code
Hi! You should be able to select the entire ZIP file and upload that rather than anything within it (so don't extract anything). Give that a go, but if it doesn't work let me know and I will extract the source code again to make sure it isn't affected by the recent upgrade to App Inventor.
Good luck with your exams!
Re: source code
Worked perfectly....thanks so much! Hopefully this will help everyone to be a better medic...or atleast in my class!. Thanks again!
Re: source code
Great to hear you are up and running with it, let me know how you get on!
Just what I needed
Thanks for posting this. I was stuck on randomizing the buttons without having repeats. I noticed that your quiz does not ask all 10 questions each time, it repeats some. How would you go about fixing this? I'll look into it and post a solution if I remember. I believe it's the same code as preventing duplicate answer options.
Re: Just what I needed
Hi Steve,
Yes I think you are right there. You would probably need to generate all of the questions and hold them in a list checking for duplicates as you go and then ask them. Let me know how you get on.
Re: Just what I needed
Thanks for this tutorial, but how do i generate all of the questions and hold them in a list checking for duplicates. I really need to know how to solve this problem. Thank you very much
Just What I Was Looking For!
Thanks for sharing this source code. I have been using the App Inventor but could not understand how to prepare an app with scores. I searched Google and found your site.
I have slightly modified the source code to get 20 questions at a time instead of 10. I have put in the data for 50 words for beginner level learners who are learning to read.
I have pictures with words. Children have to read the words and choose the one that matches with the picture. I have not solved the problem of repeated questions. Very strangely, every time I try it two words are selected for repetition and they appear at least three times.
If anyone would like to try it out and give me feedback, the download link is this: http://www.teachingstylesonline.com/phonicsreadowords.apk. If anybody needs the source code I can post that too.
I will be posting about this on Google Plus.
Thanks for sharing this.
RE: Just What I Was Looking For!
Hi there,
Thanks for your comment! It made my day to hear about an app based on RefSignals helping children to learn to read.After I published this post I got asked a lot about the repeated questions issue so I wrote a follow up post: http://www.greenhughes.com/content/refsignals-how-to-stop-repeated-ques… that explains how to make each question unique. Hope this helps!
Can't import
Hi,
I am not able to import the zip file in Eclipse.Wud you plz sugess me what sud i do ???
Re: Can't import
Hi Nishant, this is a project which works with an alternative development environment: App Inventor for Android which is all online. App Inventor does not integrate with Eclipse (though it would be fun if it did!) so sadly you cannot use it in that environment.
Something that I can't understand
Hi:
I want to adapt this app to a educational quiz. So, I want to know, when I open the blocks editor, where I write the questions and answers (my own questions and answers) ????
Thanks!
Vilmarie
How are awesome bro....
How are awesome bro.... Superb application.... Eagerly waiting for the other apps and source code from your side... thanks a lot.