Enter: Kitchen Timer
Years ago I taught myself to program PHP by focusing on both reading the PHP manual and simply starting to write. The goal was creating my own forum software (like everybody else was doing at the time) and by doing so, learning everything I needed about PHP (and MySQL for that matter).
Fast forward to now and I find myself in the same situation: I want to learn how to program for Android and I need a goal, or rather a means, to achieve that. I decided that (also like to many others are doing now) I want to write a kitchen timer.
Right now there are many kitchen timers available in the Android Play Market and I doubt that my version will be better than any one out there, but the goal is not to create the best kitchen timer ever. I’ll use it as a means to learn how to program a real app.
The best part is that I found the following open source app: Kitchen Timer for ICS by Paul Bourke (sources available here), which in turn is a port of Kitchen Timer by Roberto Leinardi (sources available here). I intend to base my project on Paul Bourke’s kitchen timer and by doing so, have a playground to learn and discover how a basic app is put together.
Whereas years ago it sufficed to simply use Notepad or any better version of that, this time I decided I wanted a tool to help me develop. Pretty soon when you start reading the Android development guide, you’ll find that Google offers the Android SDK which is a basic set of tools which you can use. This toolkit however is really the bare minimum if you ask me and that’s why Google also offers a plugin for Eclipse. Great, so now I can use an IDE to develop my kitchen timer.
All is good and well, but loading the sources to that ICS Kitchen Timer proved challenging. The sources were provided without any suggestions for opening them into Eclipse, but it seems I have finally figured things out. The trick seems to be to create a new sub directory in your Eclipse Workspace and then unzip the sources there. After that I created a new Android project in Eclipse and specify “Create project from existing source”, along with the location of where I had extracted the sources.
But other than maybe changing the name of the project (and application), I left most settings to their defaults, including the name of the package. This package name is essentially the unique identifier for the application, so for now this means that my version of the kitchen timer will basically be “the same” as Paul Bourke’s kitchen timer. I intend to ultimately change this name, but for now I’ve left it unchanged.
Other things to keep in mind is that, as the name of Paul Bourke’s kitchen timer implies, these sources are intended to run on Android 4 and up. Bear this in mind when setting up the new project in Eclipse, so that you specify the correct API level (corresponding to Android 4).
After the project had been created there were several errors indicated by Eclipse, most of them having to do with incorrectly overridden methods. To me that seemed strange and as far as I could see, there shouldn’t actually have been any compiler errors. But hey, computer says no. So, I simply removed the “@Override” annotations and the project compiled just fine.
Right now I am able to compile the app and deploy it to my tablet where it seems to run without problems. This ultimately brings me to my first challenge: Paul Bourke’s kitchen timer does not work in landscape mode which is a bit of an annoyance. This ‘problem’ also exists in Roberto Leinardi’s original kitchen timer but someone has already fixed that problem in that version. So, with some patience and research I should be able to incorporate those changes to my version of the kitchen timer.
A bonus challenge will be adding a higher resolution layout to the app, so that it will look even better on my tablet.