teaching machines

Java Flash Cards Assignment 1

September 30, 2011 by . Filed under cs491 mobile, fall 2011, postmortems.

This is a basic flash card app.  A statement about java is displayed with true and false buttons below.  There is a set of 10 questions that loop continuously as if you were studying flash cards and want to keep going through them all.  The user selects true or false and pop up message is displayed telling them if they got it right or wrong.

An extra thing I implemented was text to speech.  When the user clicks the ‘Say Whaaat!?’ button, the statement in question will be spoken.  This was much easier to implement than I thought.  There was an demo online that pretty much walked me through everything.

All you have to do is implement the TextToSpeech.OnInitListener within your activity and the onInit method that goes with it.  This onInit method tests to make sure that text to speech is supported and allows you to have your program respond to this.  I had my speak button set enabled to true after this happened so that if text to speech is not supported, the user will not be able to click the button.

After all this all you have to do is create an instance of TextToSpeech and use the speak() method such as I did below:

mTts.speak(currentQuestion, TextToSpeech.QUEUE_FLUSH, null);

This just takes the current question being displayed.

Another aspect that I would like to implement is the ability to go through the questions once and give a final score.  This would make it more like a quiz and not flash cards.  This would be something that you could change in the preferences, set it to something like ‘Quiz Mode.’  Then just keep track of correct answers and display a results screen after all the questions have been answered.