Wisespend app is going to be backed by a SQLite Database. The decision? Not clear. Let’s say that because I had not bothered yet to look for another option of storing data aside from a SQLite Database. By this early version (day two), the database was laughably simple that at first impression, using a database at all is perhaps an overkill but let’s see about that later.
KoinKuLator also built with SQLite Database and the first implementation of it was wrong on so many levels that sometimes, as the data grows, it throws, first a warning that a connection was open and never closed, more often than I would’ve liked, and finally, the dreaded Application Not Responding error box. Romain Guy (or whoever who really said it, all I remember that it was from one of Google IO 2010 keynote) says it succinctly, if your application throws an Application Not Responding, then you did something wrong. No questions necessary. Not the Dalvik’s fault, not the over-engineered Android framework’s fault, not Steve’s faults, it’s yours. Not until version 0.4, which sadly hasn’t seen the light of day just yet, that I implemented a different, more efficient approach to manage a connection to SQLite Database in KoinKuLator (see previous post on how I approached the problem and containing the use of Cursor in a strict container and not throwing/passing it everywhere).
The approach has proved itself to be, if not the most correct approach, an easier approach to be reused.
In essence, the approach was having everything centralized, rather secluded from the rest, while at the same time, maintaining the connection to several tables that sort-of representing the database structure, stored in one single class. The All Knowing Class. Or something like that. Long story short, based on the two tables that I currently produced to satisfy the need of my app, I set up a complete sort-of back-engine for it, from scratch in less than thirty minutes.
The next challenge would be wiring it all up so we get a sense on how the data is going to be created, entered, and managed for the benefit of all. Again, let’s look into my notepad. The three methods I circled are the initial functions I thought I would require and as I had mentioned before, the approach enabled me to setup it quickly. Thus, calling this as a challenge is actually an overstatement.
Now, the final part of this day is what I’d like to call a challenge. Not necessarily that it had a steep learning curve but more because it involves one of the technology I dreaded the most. XML. In this part, I’m setting up the layout to hand proper responses against actions, and to calculate the actions, and finally gave back the results of the actions. Oh, have I mentioned that I dreaded XML? I love writing codes, but writing XMLs aren’t really a walk in the park on a sunny afternoon for me. Heck, just by looking at it, I felt dread creeping up for me. It’s like a silver bullet to my Werewolf being, like a kryptonite to my Superman being.
Alas, a Man’s gotta do what He’s gotta do. Besides, I’m equally excited as I going to implement another thing that is totally new to my experience as an Android developer. Gestures.
I’m using TweetDeck as my choice of Android Twitter client. It had its ups and downs but one particular thing I’d love the most from this app is its swipe left-and-right gestures and I wish to get my hands wet implementing it. Sure, gestures are especially made for touch screen devices and, even if I’m not entirely sure, there bound to be an Android device out there without it. Thus, limiting the exposure of Wisespend app should it ever gets released. However, since my very own device is a touch screen device, and I don’t plan to release this app publicly (unless we decided to launch it), there’s nothing that could stop me from implementing it.
This article is a good point to start and I did almost bullet per bullet implementation out of it. Including, this is I think the most important part, installing a GesturesBuilder to the emulator to record the intended gestures I’d like to recognize in the app, and transferring the resulting library into a folder called ‘raw’ on Wisespend app. Long story short, I did it almost without hassle worth mentioning and thus, after re-implement it in the various places of the screen, ended the second day of the development.
To be continued …