Posts tagged ‘android’

Caltroid Project Page

Since I released the first version of Caltroid (Caltrain schedule application for Caltrain) the de facto homepage for the project has been the release announcement blog post. That is far from ideal, so I finally made a real project page for Caltroid. It has the download links, source links and so forth and will be updated if and when I continue the project. Now that there are rumors about T-Mobile shipping a real Android device in September, I have some motivation to actually do some more work on Caltroid.

Caltroid 0.1 - Caltrain Schedule for Android

I finally finished my first Google Android application which I started about 15 days ago, which was much, much longer than I expected it would take and I am still not totally happy with the way things turned out. (I did not work every day, nor did I spend full days at it, but still it compared to the 12 hours it took to create similar Python+Tkinter application it was certainly a disappointment.) Of course, this being my first Java program I guess I should not have expected miracles. My second post on the subject shed some early light on the issues I was facing.

I can sum my major Android frustrations as follows:

  • XML is required for UI
  • No drop down list control (I used Spinner instead)
  • No multicolumn list control (I used GridView instead)

I also run into some bugs, like some bug in GridView that caused crashes whenever the layout changed. Luckily there was a simple workaround with focus.

I quite liked the Eclipse plugin for Android development.

So what is the application I created? Since I have been learning new technologies by creating Caltrain schedule applications (previously with Python and Javascript), I figured I should do the same with Android. And thus Caltroid was born. It has one additional feature compared to the other schedule applications, in that it can automatically find the nearest Caltrain station using GPS information. It is not bug free (what would you expect with 0.1 release) but I think it would already be useful to someone with an Android device.

You can get the source with Subversion.

Update: You can download the complete project directory with Caltroid.apk and all. Grab your copy here. Please note that I work on Linux so files will have Linux newlines.

Update 2: I made Caltroid project page.

Screenshot: Caltroid 0.1 - Caltrain Schedule for Android

More on Android GUI Programming

Like I mentioned in my previous post, it seems it is not possible to do the UI purely programmatically using the Android Java API. Or if it is, it is either so obvious I don’t see it, or so hard I just haven’t figured it out yet. I finally decided I’ll just hop on the XML GUI bandwagon.

Which lead me to use the DroidDraw program to design my GUI, which is pretty simple and nice to use even at though it is so new (expect some glitches, but compared to working by hand you’ll be glad you used it). It also comes with some nice tutorials, and a visual guide to the UI elements (another thing which seems to be missing from the official Android documentation, by the way).

On Android Development

I’ve been tinkering with Android for a few days now, and I am bit less thrilled now. The documentation which at first blush looked great, is actually pretty minimal at places, for example the API. It would be really helpful if there were links from the API to samples where the API was used. There are also places where the API is incomplete, with notes that more is to come. There is also something strange on the official Google Android web pages which keeps Firefox consuming about 10% CPU for every window that has Android documentation pages open.

It seems like you cannot construct a UI using just the Java API; you have to refer to XML files that specify at least some parts of the layout. All the samples I have seen so far in fact go straight to XML to show how the UI is done. This seems a bit backwards to me. I would expect one to have complete freedom to do the UI in Java, and the XML format is just a nice alternative to have. Like in the wxWidgets project. The XML also has some strangeness to it in my opinion, namely with the use of @-sign to point to other resources in attribute values. And it is kind of pity that this is yet another XML language for UI, when there are already other languages available.

The community has started some pretty nice resources for Android developers. anddev.org is my favorite. Another I found is Triled. Another good tactic, as usual, is to search the web. Although with a project as new as Android, the chances of finding anything different from Google’s official pages or those two community sites are pretty slim.

First Look at Android

I just took the first look at Android documentation, and I am pretty pleased so far with the quality. I didn’t really have any major problems with downloading and installing the SDK, and Eclipse plugin. (What I did waste time on was trying to figure out if my Eclipse installation had JDT and WST installed - I think I have JDT but not WST, and trying to install WST run into an unclear plugin dependency problem.)

Creating and running the HelloAndroid sample was easy, and worked great. Now I am off to study the SDK documentation to build something with it…