Life Counter and Honeycomb

17 Jul 2011
Tags: Android and LifeCounter

A little under a month ago, I got a Honeycomb tablet. While trying it out, I noticed that some apps would only display in a small box on the top of the screen. Including Life Counter, my app.


I spent most of yesterday evening and today on the update and theoretically, the update is live, though I had to clear the My Apps cache on my Honeycomb tablet. (My Gingerbread phone had no problem immediately detecting the update).

Here is what I think of the process of Honeycombizing an Android app:

  • When I first started writing Android apps, I was confused about why they emphasized using XML based resources for layout. There had to have been simpler ways to deal with different layouts for orientation. Now that Life Counter supports multiple form factors, I understand and it’s one of the best things about development for Android.

    The ability to have an image, and then have another version for larger screens is a really good abstraction. I have four different copies of the 4 player layout depending on orientation and screen size and they’re all treated the same from code. The runtime will determine the best version for the current situation and present that to my app.

  • Integration with the ActionBar is…interesting. In the main LifeCounter activity, I use Google’s backwards compatibility library to mark the coin flip menu item so it’ll both activate the display of the action bar and put it in.

    Everywhere else, I have Honeycomb specific subclasses. For example, Coin2DActivityHC derives from Coin2DActivity, and then LifeCounter selects which activity to run at runtime. I almost never do Java; I’m a little shocked that I can compile classes that require certain APIs into “binaries” that are run on systems that don’t provide those APIs. I suppose that makes sense if class loading is lazy and binding doesn’t happen until loading time, though it still was unexpected. (In my defense, I come from a world that still uses dysym()).