Today we are going to look at another classic goal in Mobile development, data collection. You might need it for a line of business application, for example a field service application where workers need to inspection equipment and fill out a questionnaire. Or you might need it in a mobile poll taker application. You could even use it in a trivia game. There are few applications actually that couldn’t take advantage of a question and answer system like the Mobile Quiz.
Mobile Quiz
There is so much potential with this application. I hope you can see the concept and see the potential here. There are a world of possibilities here. Hopefully this application will help you get ever so slightly closer to realizing some of them.
The UI is a straight-forward and clean design, which was easy to make but should appeal to users. Everything is meant to be intuitive and self explanatory. Users should simple be able to look at the screen and get it.
The first screen is an quiz introduction form. All we have here is some eye candy, the name of the quiz, and some basic menu options: Start, About, and Exit.
After this the user is presented with the questions screen. This is the main meat of the application.
Questions are pulled from an XML file which could be retrieved from a remote server.
1: <?xml version="1.0" encoding="utf-8" ?>
2: <quiz name ="Family Guy Quiz">
3: <question>
4: <text>In what state do the Griffins live?</text>
5: <correct>2</correct>
6: <answer>Connecticuit</answer>
7: <answer>Rhode Island</answer>
8: <answer>Massachusetts</answer>
9: <answer>Deleware</answer>
10: <answer>South Carolina</answer>
11: </question>
12: <question>
13: <text>What television actor is the mayor of the town?</text>
14: <correct>1</correct>
15: <answer>Adam West</answer>
16: <answer>David Hasselhoff</answer>
17: <answer>Leonard Nimoy</answer>
18: <answer>William Shatner</answer>
19: <answer>Harrison Ford</answer>
20: </question>
21: <question>
22: <text>What is Cleveland's last name?</text>
23: <correct>1</correct>
24: <answer>Brown</answer>
25: <answer>Smith</answer>
26: <answer>Craft</answer>
27: <answer>Cub</answer>
28: <answer>Jones</answer>
29: </question>
30: <question>
31: <text>What is the name of Stewie's stuffed bear?</text>
32: <correct>3</correct>
33: <answer>Barry</answer>
34: <answer>Chris</answer>
35: <answer>Rubert</answer>
36: <answer>Edward</answer>
37: <answer>Paddy</answer>
38: </question>
39: <question>
40: <text>What is Quagmire's profession?</text>
41: <correct>4</correct>
42: <answer>Developer</answer>
43: <answer>Police Office</answer>
44: <answer>Barber</answer>
45: <answer>Pilot</answer>
46: <answer>Teacher</answer>
47: </question>
48: </quiz>
It’s a snap to open the XML file and read in all of our data.
1: DataSet dataSet = new DataSet();
2: // read quiz data file
3: dataSet.ReadXml(@"\Program Files\MobileQuiz\quiz.xml");
One thing that I decided was important was to avoid showing modal MessageBox dialogs often.
Instead I choose to use a label, place it at the top, set it’s background color to Info, and use it accordingly. This works out great and I think is a much better user experience. Data entry on a mobile device is a huge pain, and if you can take a dialog out of the equation that’s a good thing.
Download executable: mobileQuiz.cab
Download Source Code: mobileQuiz.zip
Feedback
There’s a lot here for a little effort, a couple hours, and there is a huge potential for this type of application. This would be a great project for someone to expand on and create something really special from. Consider it if you are looking for your first mobile project.