BlackBerry APIs Need Some Work

18 03 2010

While unstaffed the last few weeks, a manager tapped me to help put together a POC BlackBerry application for one of our clients. I have had experience working on a BlackBerry project from a previous employer, however I did not have hands on experience programming the device myself. I was looking forward to this as I had been wanting to do some dabbling with mobile devices, I just had not had the time.

I knew programming for BlackBerries were a bit tricky due to the numerous versions of the OS and devices, each with their own hardware specs (with or without GPS, supported resolution, touchpad, trackball, etc.). We tailored our POC for the 8800 series due to clent request and for the GPS API support. I downloaded the latest java development software, version 5.0 beta. With 11+ years of Java experience, jumping in and immediately putting together an application was easier than anticipated. However, I quickly became frustrated at the APIs (or lack thereof) that has me seriously wondering if RIM doesn’t need to do an overhaul on their APIs and development model for applications.

For example, I had RichTextFields that required a text color other than black. Nothing existed on the class that resembled a way to change the text color so I Googled. I came across several message board posts, but all seemed to point to the same resolution: override the paint(Grahpics) method of the class to change the color on the Graphics object. Say wuh? Just to change the color of the text, I had to override the entire paint method? Here’s an example of what was required:

RichFieldText rft = new RichFieldText("Here's my text") {
        public void paint(Graphics g) {

Of course, you could provide a base class responsible for these sort of things and make it available to your entire project, but this is a horrible model given the triviality of changing the text color of a text field! I found another example of this poor development model while working with the MapField class. I have to think one of the most common use cases for this component is to “mark” something on the map, once the desired location is within the view. Again, there are no APIs to provide this and to implement this fucntionality, you have to override/extend and draw the bitmap yourself:

MapField mf = new MapField() {
        protected void paint(Graphics graphics) {
                XYPoint center = new XYPoint();
                convertWorldToField(getCoordinates(), center);
                Bitmap bitmap = Bitmap.getBitmapResource("house.png");
                graphics.drawBitmap(center.x, center.y, bitmap.getWidth(), bitmap.getHeight(), bitmap, 0, 0);

I also found the lack of useable layout managers another source of frustration. It seems unless you want things lined up left to right or up to down, you really don’t have a lot of options unless you want to write something yourself. Keep in mind, I’m using the latest version of their APIs. Hard to believe.

Given the numerous devices (each with their own specifications), the various flavors of the OS, and the seemingly poor development model set forth by RIM, I can’t imagine having to develop and maintain so many code bases for a product. If the architecture and opportunity presented itself, I think I’d rather develop a web application to use the much improved BlackBerry browser or a third-party browser and tailor the view if necessary.




Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: