My app is a relatively simple and familiar app. If you’re familiar with the class MadLib game of filling in the blanks to make a silly story, then this app is for you! It’s called BadLib because the scripts aren’t that great, and neither are the resulting stories.
The app makes use of TextView, EditText, GridView, Button, and Spinner.
The app starts up with a relatively blank screen and a Spinner at the top. Scripts are loaded from a resources file as an array of strings. Each string has the script’s title, followed by a pipe character, and then the story script. The spinner is populated with the titles of the scripts found.
Upon selecting a valid script, a form appears with a GridView of EditText views, each with a hint corresponding to a word in the script that needs replacing. Below that are two buttons for resetting the form, or creating the final story.
When [Create Story] is clicked, the values the user entered are gathered up and sent along with the script to another activity. This activity assembles the final story and displays it in a TextView. It also has a button to return the user to the previous activity in order to create another script.
I learned how to use the Spinner control (pretty basic) as well as how to iterate over GridView children. I learned that heirarchial data cannot be stored in the resources xml files (which seems somewhat odd considering that’s precisely what xml was for in the first place), and I had to encode the values to get an extra layer of depth. I learned how to pass ArrayLists of Strings to an intent. Somewhat unrelated to the mobile side of things, but I also learned how to dynamically replace patterns using regular expressions in Java.