The Quiz App.

The next project after the score app was to build a quiz app. Given my medical/healthcare background, I decided to produce a Medical Quiz.

The app preparation and creation included plans with drawings, spider grams, lists, pseudocode and a variety of other planning tools before writing any code. Taking those drawings and creating an xml layout (single page) by creating, positioning and styling views then creating interactivity through button clicks and Java code – commenting and documenting the code as you went.

My six question quiz incorporated questions with radio buttons (one choice from four or five possible only), check boxes (as many possible choices as there are questions) which were used when multiple right answers were required and one EditText where the person completing the quiz would type in the correct answer – hopefully. After each question had been answered the submit answers would be pressed. When the “Submit Answers” button was pressed a pop-up message would tell how many points had been achieved with two points awarded for each correct answer, even if there were two or three correct answers per question. If all of the answers were answered correctly, a different pop-up would be seen saying “You have scored a maximum of fourteen points!” The pop-up messages are officially called “toast messages” because they pop-up – neat!

There was a problem; I gave it to my son to play with and he pointed out a problem very quickly – it has to be said that my son was in his late twenties and was already a software coding god! He had earned his living as a senior software developer for several years at that point. He said, “If I fill all of the check boxes, I can get full marks even if I have also checked the wrong answers”. I learned how to put the check boxes for a particular question into a group and then limit how many check boxes were allowed to be checked in that group. Sorting out the scores was largely about a whole load of if(namedButton.isChecked) flow control statements with the instruction to add two points to the variable “score” if it was true (the condition had been met – boolean). I submitted the project and that was the final project for the “Google Developer Challenge” part of my journey. There was a lot of speculation and activity surrounding who would be accepted onto the full Nanodegree scholarship. There had been 20,000 people chosen for the Android Basics Track and only 2,000 would go forward to the next part. They were looking for those who were able to progress with the work but they also stipulated that those most supportive, communicative and active on the various forums that they had provided. I mentioned in an earlier post about the Udacity based forums but there was also two Slack channels; one was a general Udacity Student support channel and the other was a channel for the track that we were on – so I was on the Android Basics channel. There was a lot of support on the various channels from other students, we were encouraged to support other students and there were a few mentors who helped out with queries too. In order to progress, we had to be seen to be active participants – there was a flurry of activity when we neared the end of the challenge.

Fortunately for me, I made the cut and I was invited to continue on to the next phase. There will be more about that next time…

Advertisement

The Rugby Score App

I decided to base my next project on a score app for Rugby Union football using the Court app for guidance. The app has two sets of score buttons, one for Team A and one for Team B. Each set of buttons consists of:

  • + 7 for a Penalty Try
  • + 5 for a Try
  • + 3 for a drop kick
  • + 3 for a penalty
  • + 2 for a conversion (successful kick between posts following a try being scored.
The Rugby Score Calculator.

This was an exercise about creating buttons as “onClick” events in the xml and then creating click handlers in the Java. Everything seemed to go well until I turned my phone into landscape mode – the scores disappeared. The solution, it turned out, was to create two static variables “SCORE_TEAM_A” and “SCORE_TEAM_B” the capitals to show that they were static when the user user interface refreshed, and to write two pieces of code – one to onSaveInstanceState to save the scores in those static variables and another to onRestoreInstanceState to show the scores in the refreshed page. It seemed to go well after I had got over that little problem so I submitted to the project and moved onto learning how to add other functionality. During the course all of the learners were linked by Udacity message boards with a general chat room and a chat room for each of the projects.

I will entertain you with the next instalment very soon. ‘Bye for now.