First Android App – Part 4

1 minute read

I was able to implement a core feature of the application today.  While browsing the questions (whether in a ascending or random order) when the user clicks on a question he/she will be able to see the answer to the question.  See screenshot below:

Answer showing after Click of Question

The implementation of this is quite simple.  When I first open up this activity, I retrieve the _id, question and answer from the questions table.  I then hide the TextView object that has the answer.  When I detect a click on a row of the TextView object I just display the hidden TextView object with the answer.  The only thing I have to fix now is the space between the question and the answer.

One of my goals of this feature is to allow the user to see both the question and the answer in a pretty basic/simple layout.  In order to do this, I had to re-write the code for the gui.  I am now using a RelativeLayout object with a few TextViews to accomplish the look and feel of each question/answer above.  Also, I decided to remove the word question from the question column as this was just taking up too much real estate. There are some minor bugs at the time of this article but this is not something that I can’t fix the next time I work on this application.

After I am satisfied with this feature, I’ll tackle the Flash Card mode of the application.  This feature will  allow users to study the questions in a flash card mode where while in landscape mode, the user will be able to view the question and click on it to see the answer.  Afterwards, the user will be able to click on the next button to see the next question.

Update: I fixed the duplicate entries for Question 41 above.  I had to remove the items in the insertSQL statement of my DbHelper subclass.

Leave a comment