*** 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.