• Post Reply Bookmark Topic Watch Topic
  • New Topic

Event Handlers with Flag Quiz App  RSS feed

 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Questions:

1. Describe what the code displays.
A error message would be shown when the use has selected an insufficient number of options.

2. Describe when an event handler (included in the code) gets executed?
The event handler gets executed every time a user selects an option(???)

3. Explain a feature of what is displayed

4. Explain the meaning of all of the parameters in the central, complicated call of the code.

5. Describe how the code handles two possible situations.
When the user has selected a sufficient number of options (no less than or equal to 0), then no error message would be shown.
On the other hand, an error message will be shown when the user has not selected a sufficient number of options (0). (???)




I'm not sure whether or not I am in right track, could someone please help me confirm if my answers are correct and help me answer the other ones that are left.

Thanks!
Mark
 
Bartender
Posts: 3271
82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure what half the classes mentioned in your code snippet do - I guess they are part of a library supplied by your school - but it looks to me like whenever the user clicks on an item the code is being called and is getting the current number of selected items, comparing the number to a preset value and displaying an appropriate dialog. Is that a fair assessment of the code?
 
Mark Do
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tony Docherty wrote:I'm not sure what half the classes mentioned in your code snippet do - I guess they are part of a library supplied by your school - but it looks to me like whenever the user clicks on an item the code is being called and is getting the current number of selected items, comparing the number to a preset value and displaying an appropriate dialog. Is that a fair assessment of the code?


Yep! precisely!
 
Tony Docherty
Bartender
Posts: 3271
82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Excellent In that case read my description of the code and see if the answers you have given seem reasonable. For example Q1 - can there really only be 1 possible display? etc
 
Mark Do
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Awesome!

How about these question?
1. What is the listener supplied in the 3rd parameter of the setMultiChoiceItems(…) listening for?
Which specific regions have been ticked or unticked by the user.
2. Why does the AlertDialog needs to have a button?
The purpose of having a button for the AlertDialog is to restrict the user from resetting the quiz with an insufficient number of regions.

Would these answers be acceptable??? Thanks!
 
Tony Docherty
Bartender
Posts: 3271
82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
With only having access to that small code snippet it's not possible to give accurate answers, but assuming the variables names are accurate reflections of their purpose and assuming you know what messages are displayed in the dialog and what the button that is being enabled/disabled does then your answers seem reasonable.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!