For the last few weeks, I’ve been learning how to program applications for the Android Smart phone. I bought myself a copy of “The Busy Coder’s Guide to Android Development” and my journey into Android development began! Although the book is great (the author does a great job at explaining the material quite well) I knew that the real way to learn is to actually build something. For the past few days I’d been looking for an idea of an application I could build. Well now I’ve got the idea; my sister will be taking her U.S. Citizenship test in a few months and I thought ‘why not build an application that could help her study for the exam?‘. Although I won’t be using the application myself (I became a proud citizen about 4 years ago) I will be using my experience of going thru the process to build something that I think will be useful for those who wish to be citizens of this great country!
Last night I spent about half an hour or so thinking about (and writing down) the kind of features one would want to help them study for the Civics exam. In addition, I also took a look at the existing applications available on the Android Market (and the Apple AppStore) to see what others had done already. Surprisingly, I found that there were not that many applications out there (I found about 7 or 8 on the Android Market place ) but did get some inspiration to make something better than the applications already out there. So for the next few days/weeks/months (however long it takes) I’ll write down some of my thoughts and experiences with building this application.
My approach to building this application, is to gradually build the basic components (make sure they work) and build on top of that. Below are the things I’ve done so far:
- Build the Database – This was the first thing I had to build. There are 100 questions for the civic test of which, in the civics test 10 will be randomly chosen and you are expected to answer 6 out of these 10 questions to pass this part of the examination. I looked around to see if anyone had these questions in a simple format (i.e. csv, sql, etc) that I could use to import into my application. Sadly, I could not find such a source. If it does exist, I just could not find it and I could not wait any longer as I wanted to get started on this application as soon as possible. So I had to just sit down and write down each question and answer into a csv file that I then used to import into a sqlite3 database! It was tedious, but I am glad that this is done (I have proofread the questions and answers and they all seem ok). The other thing I had to do was to make sure I entered each question and answer in a format that can then be used to display the data in a proper format. I used some basic HTML elements to enclose some of the words in both the questions and elements (using the underline and un-orderdered list did the trick) knowing full well (or at least expecting) that I could display this information properly later on. If this is not possible, then I’ll have to address this issue when the time comes along. Inserting the data into the database was quite a daunting task that I was not looking forward to. But I decided to just type in inline sql statements that would insert the data into the database and be done with this. I found out that you must call the ‘execSQL’ each time for each record you will be inserting into the database. Originally I just passed a concatenated string to this method but this didn’t work!
- Package Name and Objects – The next thing I had to think about is how I would be organizing my classes. I decided to have a few top level package names to help me organize the project. I have a ‘ui’ package for all of the activities that the user will be interacting with. I have a ‘db’ package for all database related classes and I have a ‘util’ package for any other classes/static methods/constants I will use throughout the application.
- Adapters and Holders – I have built the basic Adapters and Holder objects used to display the list of 100 questions to the user. I am able to retrieve all 100 questions and show both the question number and the question itself to the user. My plan is that if a user selects one of the questions he/she will be taken to the answer of that question and afterwards the user can return back to the list of questions. This should be good for the time being
As stated above, I’ve build most of the parts for the most basic use of the application. Once I have this working correctly I’ll start playing around with themes and make sure that the application has a good look and feel to it. This is an important part of any application (more so in the mobile world) as the look and feel of an application may mean the difference between as successful application or one that is not! So I am looking forward to working on this application and as I continue on this journey, I will note down whatever notes I’ve deemed interesting on this little blog! My goal is to have a basic application that I can put out on the market within one month or so!