Thursday, April 14, 2011

Google I/O Developer Conference

I'm thrilled to announce that I will be attending Google's I/O Developer Conference this May. The yearly conference covers everything nerdy at Google from App Engine to Android.

Even more exciting is that I won my ticket in the Last Call for Google I/O 2011 Android Challenge. 10 winners were chosen from 70 app submissions. The contest was particularly challenging as contestants had 20 hours to work. Subtract eight hours for sleep as this new dad was not about to pull an all-nighter and use much needed sleep. Despite never writing any animation in Android, I managed to pull something out with about 2 hours to spare.

Revisiting ItemizedOverlay

I previously blogged on ArrayIndexOutOfBoundException when modifying ItemizedOverlay items on-the-fly, stating that they could be avoided. After much more use, I no longer believe ItemizedOverlay is safe for maps where content changes.

If you're developing an application that uses Google's Map API for Android and you need to add/remove items from the map while displaying the map, you have a few options:

1) "Allocate" all your objects in advance and disable items that should not be shown. This means you will not add/remove items to the ItemizedOverlay backing collection, but instead manage which ones are drawn in the draw() method. This may work well for many, but did not work for my scenario.

2) Create your own implementation of Overlay that handles concurrent modifications to its data structure. I chose this option, in particular because I didn't need all the capability that ItemizedOverlay offers.

3) Something else?